• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 
18 #define private public
19 #define protected public
20 #include "extension_base.h"
21 #include "ui_extension_context.h"
22 #undef private
23 #undef protected
24 
25 #include "hilog_tag_wrapper.h"
26 #include "want.h"
27 #include "mock_window.h"
28 
29 using namespace testing::ext;
30 using namespace OHOS::Rosen;
31 
32 namespace OHOS {
33 namespace AbilityRuntime {
34 class UIExtensionContextTest : public testing::Test {
35 public:
36     static void SetUpTestCase();
37     static void TearDownTestCase();
38     void SetUp() override;
39     void TearDown() override;
40 };
41 
SetUpTestCase(void)42 void UIExtensionContextTest::SetUpTestCase(void)
43 {}
44 
TearDownTestCase(void)45 void UIExtensionContextTest::TearDownTestCase(void)
46 {}
47 
SetUp()48 void UIExtensionContextTest::SetUp()
49 {}
50 
TearDown()51 void UIExtensionContextTest::TearDown()
52 {}
53 
54 /**
55  * @tc.number: StartUIServiceExtension_0100
56  * @tc.name: StartUIServiceExtension
57  * @tc.desc: Start a new ability.
58  */
59 HWTEST_F(UIExtensionContextTest, StartUIServiceExtension_0100, TestSize.Level1)
60 {
61     TAG_LOGI(AAFwkTag::TEST, "StartUIServiceExtension_0100 start");
62 
63     auto context = std::make_shared<UIExtensionContext>();
64     AAFwk::Want want;
65     int32_t accountId = 1;
66 
67     EXPECT_TRUE(context->StartUIServiceExtension(want, accountId) != ERR_OK);
68     TAG_LOGI(AAFwkTag::TEST, "StartUIServiceExtension_0100 end");
69 }
70 } // namespace AbilityRuntime
71 } // namespace OHOS
72