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 "daudio_hidumper_test.h"
17 #include "daudio_hitrace.h"
18
19 using namespace testing::ext;
20
21 namespace OHOS {
22 namespace DistributedHardware {
SetUpTestCase(void)23 void DAudioHidumperTest::SetUpTestCase(void) {}
24
TearDownTestCase(void)25 void DAudioHidumperTest::TearDownTestCase(void) {}
26
SetUp()27 void DAudioHidumperTest::SetUp()
28 {
29 hidumper_ = std::make_shared<DaudioHidumper>();
30 }
31
TearDown()32 void DAudioHidumperTest::TearDown()
33 {
34 hidumper_ = nullptr;
35 }
36
37 /**
38 * @tc.name: OnStateChange_001
39 * @tc.desc: Verify the OnStateChange function.
40 * @tc.type: FUNC
41 * @tc.require: AR000H0E6G
42 */
43 HWTEST_F(DAudioHidumperTest, Dump_001, TestSize.Level1)
44 {
45 std::string result;
46 std::vector<std::string> args;
47 EXPECT_EQ(true, hidumper_->Dump(args, result));
48 args = { "-h"};
49 EXPECT_EQ(true, hidumper_->Dump(args, result));
50 args = {"--sourceDevId"};
51 EXPECT_NE(true, hidumper_->Dump(args, result));
52 args = {"--sinkInfo"};
53 hidumper_->Dump(args, result);
54 args = {"--ability"};
55 EXPECT_EQ(true, hidumper_->Dump(args, result));
56 args = {"-h", "--ability"};
57 EXPECT_EQ(true, hidumper_->Dump(args, result));
58 }
59 } // DistributedHardware
60 } // OHOS
61