• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <cstdint>
17 #include <gtest/gtest.h>
18 #include "mock_screen_manager_service.h"
19 #include "display_manager.h"
20 #include "window_agent.h"
21 #include "window_impl.h"
22 #include "window_property.h"
23 #include "window_root.h"
24 #include "wm_common.h"
25 
26 using namespace testing;
27 using namespace testing::ext;
28 
29 namespace OHOS {
30 namespace Rosen {
31 namespace {
32     constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "MockScreenManagerServiceTest"};
33 }
34 
35 class MockScreenManagerServiceTest : public testing::Test {
36 public:
37     static void SetUpTestCase();
38     static void TearDownTestCase();
39     void SetUp() override;
40     void TearDown() override;
41 };
42 
SetUpTestCase()43 void MockScreenManagerServiceTest::SetUpTestCase()
44 {
45 }
46 
TearDownTestCase()47 void MockScreenManagerServiceTest::TearDownTestCase()
48 {
49 }
50 
SetUp()51 void MockScreenManagerServiceTest::SetUp()
52 {
53 }
54 
TearDown()55 void MockScreenManagerServiceTest::TearDown()
56 {
57 }
58 
59 namespace {
60 /**
61  * @tc.name: OnStart1
62  * @tc.desc: on start
63  * @tc.type: FUNC
64  */
65 HWTEST_F(MockScreenManagerServiceTest, OnStart1, Function | SmallTest | Level2)
66 {
67     WLOGI("OnStart01");
68     auto res = WMError::WM_OK;
69     MockScreenManagerService::GetInstance().OnStart();
70     ASSERT_EQ(WMError::WM_OK, res);
71 }
72 
73 /**
74  * @tc.name: GetScreenDumpInfo
75  * @tc.desc: get screen dump info
76  * @tc.type: FUNC
77  */
78 HWTEST_F(MockScreenManagerServiceTest, GetScreenDumpInfo, Function | SmallTest | Level2)
79 {
80     std::vector<std::string> params;
81     std::string info;
82     auto ret = WMError::WM_OK;
83     MockScreenManagerService::GetInstance().GetScreenDumpInfo(params, info);
84     ASSERT_EQ(WMError::WM_OK, ret);
85 }
86 
87 /**
88  * @tc.name: Dump
89  * @tc.desc: Dump
90  * @tc.type: FUNC
91  */
92 HWTEST_F(MockScreenManagerServiceTest, Dump, Function | SmallTest | Level2)
93 {
94     std::vector<std::u16string> args;
95     auto ret = 0;
96     ret = MockScreenManagerService::GetInstance().Dump(0, args);
97     ASSERT_NE(0, ret);
98 }
99 }
100 }
101 }