• 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 #include "screen_common_test.h"
16 
17 #include "dscreen_errcode.h"
18 #include "dscreen_hisysevent.h"
19 #include "dscreen_sa_process_state.h"
20 #include "dscreen_log.h"
21 #include "dscreen_util.h"
22 using namespace testing::ext;
23 
24 namespace OHOS {
25 namespace DistributedHardware {
SetUpTestCase(void)26 void ScreenCommonTest::SetUpTestCase(void) {}
27 
TearDownTestCase(void)28 void ScreenCommonTest::TearDownTestCase(void) {}
29 
SetUp()30 void ScreenCommonTest::SetUp() {}
31 
TearDown()32 void ScreenCommonTest::TearDown() {}
33 
34 /**
35  * @tc.name: common_001
36  * @tc.desc: Verify the common function.
37  * @tc.type: FUNC
38  * @tc.require: Issue Number
39  */
40 HWTEST_F(ScreenCommonTest, common_001, TestSize.Level1)
41 {
42     DHLOGW("common_001.");
43     SetSourceProcessExit();
44     std::string networkId = "networkId";
45     int32_t ret = GetLocalDeviceNetworkId(networkId);
46     EXPECT_NE(DH_SUCCESS, ret);
47 }
48 
49 /**
50  * @tc.name: common_002
51  * @tc.desc: Verify the common function.
52  * @tc.type: FUNC
53  * @tc.require: Issue Number
54  */
55 HWTEST_F(ScreenCommonTest, common_002, TestSize.Level1)
56 {
57     DHLOGW("common_002.");
58     ReportSaFail(eventName, errCode, saId, errMsg);
59     ReportSaFail(eventName, errCode, saId, errMsg);
60     ReportRegisterFail(eventName, errCode, devId, dhId, errMsg);
61     ReportUnRegisterFail(eventName, errCode, devId, dhId, errMsg);
62     ReportOptFail(eventName, errCode, errMsg);
63     ReportSaEvent(eventName, saId, errMsg);
64     ReportRegisterScreenEvent(eventName, devId, dhId, errMsg);
65     ReportUnRegisterScreenEvent(eventName, devId, dhId, errMsg);
66     ReportScreenMirrorEvent(eventName, devId, dhId, errMsg);
67     std::string value = "Id";
68     std::string ret = GetAnonyString(value);
69     EXPECT_EQ("******", ret);
70 }
71 
72 /**
73  * @tc.name: common_003
74  * @tc.desc: Verify the common function.
75  * @tc.type: FUNC
76  * @tc.require: Issue Number
77  */
78 HWTEST_F(ScreenCommonTest, common_003, TestSize.Level1)
79 {
80     DHLOGW("common_003.");
81     std::string value = "Id";
82     std::string ret = GetInterruptString(value);
83     EXPECT_EQ(value, ret);
84 }
85 
86 /**
87  * @tc.name: common_004
88  * @tc.desc: Verify the common function.
89  * @tc.type: FUNC
90  * @tc.require: Issue Number
91  */
92 HWTEST_F(ScreenCommonTest, common_004, TestSize.Level1)
93 {
94     DHLOGW("common_004.");
95     std::string value = "Idvalues";
96     std::string ret = GetInterruptString(value);
97     EXPECT_EQ("Idva", ret);
98 }
99 } // namespace DistributedHardware
100 } // namespace OHOS