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_hidumper.h"
19 #include "distributed_camera_errno.h"
20 #include "distributed_hardware_log.h"
21
22 using namespace testing::ext;
23
24 namespace OHOS {
25 namespace DistributedHardware {
26 class DcameraHidumperTest : public testing::Test {
27 public:
28 static void SetUpTestCase(void);
29 static void TearDownTestCase(void);
30 void SetUp();
31 void TearDown();
32 };
33
SetUpTestCase(void)34 void DcameraHidumperTest::SetUpTestCase(void)
35 {
36 DHLOGI("enter");
37 }
38
TearDownTestCase(void)39 void DcameraHidumperTest::TearDownTestCase(void)
40 {
41 DHLOGI("enter");
42 }
43
SetUp(void)44 void DcameraHidumperTest::SetUp(void)
45 {
46 DHLOGI("enter");
47 }
48
TearDown(void)49 void DcameraHidumperTest::TearDown(void)
50 {
51 DHLOGI("enter");
52 }
53
54 /**
55 * @tc.name: GetDumpFlag_001
56 * @tc.desc: Verify the GetDumpFlag function failed.
57 * @tc.type: FUNC
58 * @tc.require: Issue Number
59 */
60 HWTEST_F(DcameraHidumperTest, GetDumpFlag_001, TestSize.Level1)
61 {
62 EXPECT_EQ(false, DcameraHidumper::GetInstance().GetDumpFlag());
63 }
64
65 /**
66 * @tc.name: SetDumpFlag_001
67 * @tc.desc: Verify the StartDump function failed.
68 * @tc.type: FUNC
69 * @tc.require: Issue Number
70 */
71 HWTEST_F(DcameraHidumperTest, SetDumpFlag_001, TestSize.Level1)
72 {
73 EXPECT_EQ(DCAMERA_OK, DcameraHidumper::GetInstance().StartDump());
74 EXPECT_EQ(true, DcameraHidumper::GetInstance().GetDumpFlag());
75 }
76
77 /**
78 * @tc.name: ResetDumpFlag_001
79 * @tc.desc: Verify the StopDump function failed.
80 * @tc.type: FUNC
81 * @tc.require: Issue Number
82 */
83 HWTEST_F(DcameraHidumperTest, ResetDumpFlag_001, TestSize.Level1)
84 {
85 EXPECT_EQ(DCAMERA_OK, DcameraHidumper::GetInstance().StopDump());
86 EXPECT_EQ(false, DcameraHidumper::GetInstance().GetDumpFlag());
87 }
88 } // namespace DistributedHardware
89 } // namespace OHOS