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 #include "window_manager_agent_proxy.h"
18 #include "window_manager_agent.h"
19
20 using namespace testing;
21 using namespace testing::ext;
22
23 namespace OHOS {
24 namespace Rosen {
25 class WindowManagerAgentProxyTest : public testing::Test {
26 public:
27 static void SetUpTestCase();
28 static void TearDownTestCase();
29 void SetUp() override;
30 void TearDown() override;
31 sptr<WindowManagerAgent> mockWindowManagerAgent_;
32 sptr<WindowManagerAgentProxy> windowManagerAgentProxy_;
33 };
34
SetUpTestCase()35 void WindowManagerAgentProxyTest::SetUpTestCase()
36 {
37 }
38
TearDownTestCase()39 void WindowManagerAgentProxyTest::TearDownTestCase()
40 {
41 }
42
SetUp()43 void WindowManagerAgentProxyTest::SetUp()
44 {
45 mockWindowManagerAgent_ = new WindowManagerAgent();
46 windowManagerAgentProxy_ = new WindowManagerAgentProxy(mockWindowManagerAgent_);
47 }
48
TearDown()49 void WindowManagerAgentProxyTest::TearDown()
50 {
51 }
52
53 namespace {
54 /**
55 * @tc.name: UpdateFocusChangeInfo01
56 * @tc.desc: test success
57 * @tc.type: FUNC
58 */
59 HWTEST_F(WindowManagerAgentProxyTest, UpdateFocusChangeInfo01, Function | SmallTest | Level2)
60 {
61 sptr<FocusChangeInfo> focusChangeInfo;
62 windowManagerAgentProxy_->UpdateFocusChangeInfo(focusChangeInfo, false);
63 }
64
65 /**
66 * @tc.name: UpdateFocusChangeInfo02
67 * @tc.desc: test failed
68 * @tc.type: FUNC
69 */
70 HWTEST_F(WindowManagerAgentProxyTest, UpdateFocusChangeInfo02, Function | SmallTest | Level2)
71 {
72 sptr<FocusChangeInfo> focusChangeInfo = nullptr;
73 windowManagerAgentProxy_->UpdateFocusChangeInfo(focusChangeInfo, false);
74 }
75
76 /**
77 * @tc.name: UpdateSystemBarRegionTints01
78 * @tc.desc: test success
79 * @tc.type: FUNC
80 */
81 HWTEST_F(WindowManagerAgentProxyTest, UpdateSystemBarRegionTints01, Function | SmallTest | Level2)
82 {
83 SystemBarRegionTints tints;
84 windowManagerAgentProxy_->UpdateSystemBarRegionTints(0, tints);
85 }
86
87 /**
88 * @tc.name: NotifyAccessibilityWindowInfo01
89 * @tc.desc: test success
90 * @tc.type: FUNC
91 */
92 HWTEST_F(WindowManagerAgentProxyTest, NotifyAccessibilityWindowInfo01, Function | SmallTest | Level2)
93 {
94 std::vector<sptr<AccessibilityWindowInfo>> info;
95 WindowUpdateType type = WindowUpdateType::WINDOW_UPDATE_ADDED;
96 windowManagerAgentProxy_->NotifyAccessibilityWindowInfo(info, type);
97 }
98
99 /**
100 * @tc.name: UpdateWindowVisibilityInfo01
101 * @tc.desc: test success
102 * @tc.type: FUNC
103 */
104 HWTEST_F(WindowManagerAgentProxyTest, UpdateWindowVisibilityInfo01, Function | SmallTest | Level2)
105 {
106 std::vector<sptr<WindowVisibilityInfo>> visibilityInfos;
107 windowManagerAgentProxy_->UpdateWindowVisibilityInfo(visibilityInfos);
108 }
109
110 /**
111 * @tc.name: UpdateCameraFloatWindowStatus01
112 * @tc.desc: test success
113 * @tc.type: FUNC
114 */
115 HWTEST_F(WindowManagerAgentProxyTest, UpdateCameraFloatWindowStatus01, Function | SmallTest | Level2)
116 {
117 windowManagerAgentProxy_->UpdateCameraFloatWindowStatus(100, false);
118 }
119
120 }
121 }
122 }
123