1 /*
2  * Copyright (c) 2023 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 "root_scene_session.h"
17 #include <gtest/gtest.h>
18 #include "session_info.h"
19 
20 using namespace testing;
21 using namespace testing::ext;
22 
23 namespace OHOS {
24 namespace Rosen {
25 class RootSceneSessionTest : public testing::Test {
26 public:
27     static void SetUpTestCase();
28     static void TearDownTestCase();
29     void SetUp() override;
30     void TearDown() override;
31 };
32 
LoadContentFuncTest(const std::string &,napi_env,napi_value,AbilityRuntime::Context *)33 void LoadContentFuncTest(const std::string&, napi_env, napi_value, AbilityRuntime::Context*)
34 {
35 }
36 
SetUpTestCase()37 void RootSceneSessionTest::SetUpTestCase()
38 {
39 }
40 
TearDownTestCase()41 void RootSceneSessionTest::TearDownTestCase()
42 {
43 }
44 
SetUp()45 void RootSceneSessionTest::SetUp()
46 {
47 }
48 
TearDown()49 void RootSceneSessionTest::TearDown()
50 {
51 }
52 
53 namespace {
54 /**
55  * @tc.name: SetLoadContentFunc
56  * @tc.desc: test function : SetLoadContentFunc
57  * @tc.type: FUNC
58  */
59 HWTEST_F(RootSceneSessionTest, SetLoadContentFunc, Function | SmallTest | Level1)
60 {
61     RootSceneSession rootSceneSession;
62     RootSceneSession::LoadContentFunc loadContentFunc_ = LoadContentFuncTest;
63     rootSceneSession.SetLoadContentFunc(loadContentFunc_);
64     ASSERT_FALSE(rootSceneSession.IsVisible());
65 }
66 
67 /**
68  * @tc.name: LoadContentFunc
69  * @tc.desc: test function : LoadContentFunc
70  * @tc.type: FUNC
71  */
72 HWTEST_F(RootSceneSessionTest, LoadContentFunc, Function | SmallTest | Level1)
73 {
74     RootSceneSession rootSceneSession;
75     std::string strTest("LoadContentFuncTest");
76     napi_env nativeEnv_ = nullptr;
77     napi_value nativeValue_ = nullptr;
78     AbilityRuntime::Context* conText_ = nullptr;
79     rootSceneSession.LoadContent(strTest, nativeEnv_, nativeValue_, conText_);
80     ASSERT_FALSE(rootSceneSession.IsVisible());
81 }
82 
83 /**
84  * @tc.name: LoadContent
85  * @tc.desc: test function : LoadContent
86  * @tc.type: FUNC
87  */
88 HWTEST_F(RootSceneSessionTest, LoadContent, Function | SmallTest | Level1)
89 {
90     RootSceneSession rootSceneSession;
91     std::string strTest("LoadContentFuncTest");
92     napi_env nativeEnv_ = nullptr;
93     napi_value nativeValue_ = nullptr;
94     AbilityRuntime::Context* conText_ = nullptr;
95     RootSceneSession::LoadContentFunc loadContentFunc_ = LoadContentFuncTest;
96     rootSceneSession.SetLoadContentFunc(loadContentFunc_);
97     rootSceneSession.LoadContent(strTest, nativeEnv_, nativeValue_, conText_);
98     ASSERT_FALSE(rootSceneSession.IsVisible());
99 }
100 
101 }
102 }
103 }