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