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 
18 #include "dcamera_sink_hidumper.h"
19 #include "distributed_hardware_log.h"
20 
21 using namespace testing::ext;
22 
23 namespace OHOS {
24 namespace DistributedHardware {
25 class DcameraSinkHidumperTest : public testing::Test {
26 public:
27     static void SetUpTestCase(void);
28     static void TearDownTestCase(void);
29     void SetUp();
30     void TearDown();
31 };
32 
SetUpTestCase(void)33 void DcameraSinkHidumperTest::SetUpTestCase(void)
34 {
35     DHLOGI("enter");
36 }
37 
TearDownTestCase(void)38 void DcameraSinkHidumperTest::TearDownTestCase(void)
39 {
40     DHLOGI("enter");
41 }
42 
SetUp(void)43 void DcameraSinkHidumperTest::SetUp(void)
44 {
45     DHLOGI("enter");
46 }
47 
TearDown(void)48 void DcameraSinkHidumperTest::TearDown(void)
49 {
50     DHLOGI("enter");
51 }
52 
53 /**
54  * @tc.name: dcamera_sink_hidumper_test_001
55  * @tc.desc: Verify the Dump function.
56  * @tc.type: FUNC
57  * @tc.require: issue
58  */
59 HWTEST_F(DcameraSinkHidumperTest, dcamera_sink_hidumper_test_001, TestSize.Level1)
60 {
61     DHLOGI("dcamera_sink_hidumper_test_001");
62     std::vector<std::string> args;
63     std::string result;
64     bool ret = DcameraSinkHidumper::GetInstance().Dump(args, result);
65     EXPECT_EQ(true, ret);
66 }
67 
68 /**
69  * @tc.name: dcamera_sink_hidumper_test_002
70  * @tc.desc: Verify the Dump function.
71  * @tc.type: FUNC
72  * @tc.require: issue
73  */
74 HWTEST_F(DcameraSinkHidumperTest, dcamera_sink_hidumper_test_002, TestSize.Level1)
75 {
76     DHLOGI("dcamera_sink_hidumper_test_002");
77     std::vector<std::string> args;
78     std::string str1 = "--version";
79     std::string str2 = "--camNum";
80     args.push_back(str1);
81     args.push_back(str2);
82     std::string result;
83     bool ret = DcameraSinkHidumper::GetInstance().Dump(args, result);
84     EXPECT_EQ(true, ret);
85 }
86 
87 /**
88  * @tc.name: dcamera_sink_hidumper_test_003
89  * @tc.desc: Verify the Dump function.
90  * @tc.type: FUNC
91  * @tc.require: issue
92  */
93 HWTEST_F(DcameraSinkHidumperTest, dcamera_sink_hidumper_test_003, TestSize.Level1)
94 {
95     DHLOGI("dcamera_sink_hidumper_test_003");
96     std::vector<std::string> args;
97     std::string str1 = "--version";
98     args.push_back(str1);
99     std::string result;
100     bool ret = DcameraSinkHidumper::GetInstance().Dump(args, result);
101     EXPECT_EQ(true, ret);
102 }
103 
104 /**
105  * @tc.name: dcamera_sink_hidumper_test_004
106  * @tc.desc: Verify the Dump function.
107  * @tc.type: FUNC
108  * @tc.require: issue
109  */
110 HWTEST_F(DcameraSinkHidumperTest, dcamera_sink_hidumper_test_004, TestSize.Level1)
111 {
112     DHLOGI("dcamera_sink_hidumper_test_004");
113     std::vector<std::string> args;
114     std::string str1 = "--camNum";
115     args.push_back(str1);
116     std::string result;
117     bool ret = DcameraSinkHidumper::GetInstance().Dump(args, result);
118     EXPECT_EQ(true, ret);
119 }
120 
121 /**
122  * @tc.name: dcamera_sink_hidumper_test_005
123  * @tc.desc: Verify the Dump function.
124  * @tc.type: FUNC
125  * @tc.require: issue
126  */
127 HWTEST_F(DcameraSinkHidumperTest, dcamera_sink_hidumper_test_005, TestSize.Level1)
128 {
129     DHLOGI("dcamera_sink_hidumper_test_005");
130     std::vector<std::string> args;
131     std::string str1 = "--opened";
132     args.push_back(str1);
133     std::string result;
134     bool ret = DcameraSinkHidumper::GetInstance().Dump(args, result);
135     EXPECT_EQ(true, ret);
136 }
137 
138 /**
139  * @tc.name: dcamera_sink_hidumper_test_006
140  * @tc.desc: Verify the Dump function.
141  * @tc.type: FUNC
142  * @tc.require: issue
143  */
144 HWTEST_F(DcameraSinkHidumperTest, dcamera_sink_hidumper_test_006, TestSize.Level1)
145 {
146     DHLOGI("dcamera_sink_hidumper_test_006");
147     std::vector<std::string> args;
148     std::string str1 = "-h";
149     args.push_back(str1);
150     std::string result;
151     bool ret = DcameraSinkHidumper::GetInstance().Dump(args, result);
152     EXPECT_EQ(true, ret);
153 }
154 
155 /**
156  * @tc.name: dcamera_sink_hidumper_test_007
157  * @tc.desc: Verify the Dump function.
158  * @tc.type: FUNC
159  * @tc.require: issue
160  */
161 HWTEST_F(DcameraSinkHidumperTest, dcamera_sink_hidumper_test_007, TestSize.Level1)
162 {
163     DHLOGI("dcamera_sink_hidumper_test_007");
164     std::vector<std::string> args;
165     std::string str1 = "-help";
166     args.push_back(str1);
167     std::string result;
168     bool ret = DcameraSinkHidumper::GetInstance().Dump(args, result);
169     EXPECT_EQ(true, ret);
170 }
171 
172 /**
173  * @tc.name: dcamera_sink_hidumper_test_008
174  * @tc.desc: Verify the Dump function.
175  * @tc.type: FUNC
176  * @tc.require: issue
177  */
178 HWTEST_F(DcameraSinkHidumperTest, dcamera_sink_hidumper_test_008, TestSize.Level1)
179 {
180     DHLOGI("dcamera_sink_hidumper_test_008");
181     std::vector<std::string> args;
182     std::string str1 = "--startdump";
183     args.push_back(str1);
184     std::string result;
185     bool ret = DcameraSinkHidumper::GetInstance().Dump(args, result);
186     EXPECT_EQ(true, ret);
187 }
188 
189 /**
190  * @tc.name: dcamera_sink_hidumper_test_009
191  * @tc.desc: Verify the Dump function.
192  * @tc.type: FUNC
193  * @tc.require: issue
194  */
195 HWTEST_F(DcameraSinkHidumperTest, dcamera_sink_hidumper_test_009, TestSize.Level1)
196 {
197     DHLOGI("dcamera_sink_hidumper_test_009");
198     std::vector<std::string> args;
199     std::string str1 = "--stopdump";
200     args.push_back(str1);
201     std::string result;
202     bool ret = DcameraSinkHidumper::GetInstance().Dump(args, result);
203     EXPECT_EQ(true, ret);
204 }
205 } // namespace DistributedHardware
206 } // namespace OHOS