• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 #include "session_manager/include/scene_session_manager.h"
19 #include "session_manager/include/scene_session_manager_lite.h"
20 
21 using namespace testing;
22 using namespace testing::ext;
23 
24 namespace OHOS {
25 namespace Rosen {
26 class SceneSessionManagerLiteTest : public testing::Test {
27 public:
28     static void SetUpTestCase();
29     static void TearDownTestCase();
30     void SetUp() override;
31     void TearDown() override;
32 };
33 
SetUpTestCase()34 void SceneSessionManagerLiteTest::SetUpTestCase() {}
35 
TearDownTestCase()36 void SceneSessionManagerLiteTest::TearDownTestCase() {}
37 
SetUp()38 void SceneSessionManagerLiteTest::SetUp() {}
39 
TearDown()40 void SceneSessionManagerLiteTest::TearDown() {}
41 
42 namespace {
43 /**
44  * @tc.name: GetInstance
45  * @tc.desc: test function : GetInstance
46  * @tc.type: FUNC
47  */
48 HWTEST_F(SceneSessionManagerLiteTest, GetInstance, TestSize.Level1)
49 {
50     SceneSessionManagerLite& instance1 = SceneSessionManagerLite::GetInstance();
51     EXPECT_NE(nullptr, &instance1);
52     SceneSessionManagerLite& instance2 = SceneSessionManagerLite::GetInstance();
53     EXPECT_EQ(&instance1, &instance2);
54 }
55 
56 /**
57  * @tc.name: SendPointerEventForHover
58  * @tc.desc: test function : SendPointerEventForHover
59  * @tc.type: FUNC
60  */
61 HWTEST_F(SceneSessionManagerLiteTest, SendPointerEventForHover, TestSize.Level1)
62 {
63     std::shared_ptr<MMI::PointerEvent> pointerEvent = MMI::PointerEvent::Create();
64     EXPECT_EQ(SceneSessionManagerLite::GetInstance().SendPointerEventForHover(pointerEvent),
65         WSError::WS_ERROR_INVALID_PERMISSION);
66 }
67 
68 /**
69  * @tc.name: IsFocusWindowParent
70  * @tc.desc: test function : IsFocusWindowParent
71  * @tc.type: FUNC
72  */
73 HWTEST_F(SceneSessionManagerLiteTest, IsFocusWindowParent, TestSize.Level1)
74 {
75     sptr<IRemoteObject> token = nullptr;
76     bool isParent = false;
77     EXPECT_EQ(SceneSessionManagerLite::GetInstance().IsFocusWindowParent(token, isParent),
78         WSError::WS_ERROR_INVALID_PERMISSION);
79 }
80 } // namespace
81 } // namespace Rosen
82 } // namespace OHOS