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_source_hidumper.h"
19 #include "distributed_hardware_log.h"
20
21 using namespace testing::ext;
22
23 namespace OHOS {
24 namespace DistributedHardware {
25 class DcameraSourceHidumperTest : 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 DcameraSourceHidumperTest::SetUpTestCase(void)
34 {
35 DHLOGI("DcameraSourceHidumperTest::SetUpTestCase");
36 }
37
TearDownTestCase(void)38 void DcameraSourceHidumperTest::TearDownTestCase(void)
39 {
40 DHLOGI("DcameraSourceHidumperTest::TearDownTestCase");
41 }
42
SetUp(void)43 void DcameraSourceHidumperTest::SetUp(void)
44 {
45 DHLOGI("DcameraSourceHidumperTest::SetUp");
46 }
47
TearDown(void)48 void DcameraSourceHidumperTest::TearDown(void)
49 {
50 DHLOGI("DcameraSourceHidumperTest::TearDown");
51 }
52
53 /**
54 * @tc.name: dcamera_source_hidumper_test_001
55 * @tc.desc: Verify the Dump function.
56 * @tc.type: FUNC
57 * @tc.require: issue
58 */
59 HWTEST_F(DcameraSourceHidumperTest, dcamera_source_hidumper_test_001, TestSize.Level1)
60 {
61 DHLOGI("DcameraSourceHidumperTest::dcamera_source_hidumper_test_001");
62 std::vector<std::string> args;
63 std::string result;
64 bool ret = DcameraSourceHidumper::GetInstance().Dump(args, result);
65 EXPECT_EQ(true, ret);
66 }
67
68 /**
69 * @tc.name: dcamera_source_hidumper_test_002
70 * @tc.desc: Verify the Dump function.
71 * @tc.type: FUNC
72 * @tc.require: issue
73 */
74 HWTEST_F(DcameraSourceHidumperTest, dcamera_source_hidumper_test_002, TestSize.Level1)
75 {
76 DHLOGI("DcameraSourceHidumperTest::dcamera_source_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 = DcameraSourceHidumper::GetInstance().Dump(args, result);
84 EXPECT_EQ(true, ret);
85 }
86
87 /**
88 * @tc.name: dcamera_source_hidumper_test_003
89 * @tc.desc: Verify the Dump function.
90 * @tc.type: FUNC
91 * @tc.require: issue
92 */
93 HWTEST_F(DcameraSourceHidumperTest, dcamera_source_hidumper_test_003, TestSize.Level1)
94 {
95 DHLOGI("DcameraSourceHidumperTest::dcamera_source_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 = DcameraSourceHidumper::GetInstance().Dump(args, result);
101 EXPECT_EQ(true, ret);
102 }
103
104 /**
105 * @tc.name: dcamera_source_hidumper_test_004
106 * @tc.desc: Verify the Dump function.
107 * @tc.type: FUNC
108 * @tc.require: issue
109 */
110 HWTEST_F(DcameraSourceHidumperTest, dcamera_source_hidumper_test_004, TestSize.Level1)
111 {
112 DHLOGI("DcameraSourceHidumperTest::dcamera_source_hidumper_test_004");
113 std::vector<std::string> args;
114 std::string str1 = "--registered";
115 args.push_back(str1);
116 std::string result;
117 bool ret = DcameraSourceHidumper::GetInstance().Dump(args, result);
118 EXPECT_EQ(true, ret);
119 }
120
121 /**
122 * @tc.name: dcamera_source_hidumper_test_005
123 * @tc.desc: Verify the Dump function.
124 * @tc.type: FUNC
125 * @tc.require: issue
126 */
127 HWTEST_F(DcameraSourceHidumperTest, dcamera_source_hidumper_test_005, TestSize.Level1)
128 {
129 DHLOGI("DcameraSourceHidumperTest::dcamera_source_hidumper_test_005");
130 std::vector<std::string> args;
131 std::string str1 = "--curState";
132 args.push_back(str1);
133 std::string result;
134 bool ret = DcameraSourceHidumper::GetInstance().Dump(args, result);
135 EXPECT_EQ(true, ret);
136 }
137
138 /**
139 * @tc.name: dcamera_source_hidumper_test_006
140 * @tc.desc: Verify the Dump function.
141 * @tc.type: FUNC
142 * @tc.require: issue
143 */
144 HWTEST_F(DcameraSourceHidumperTest, dcamera_source_hidumper_test_006, TestSize.Level1)
145 {
146 DHLOGI("DcameraSourceHidumperTest::dcamera_source_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 = DcameraSourceHidumper::GetInstance().Dump(args, result);
152 EXPECT_EQ(true, ret);
153 }
154 } // namespace DistributedHardware
155 } // namespace OHOS