1 /*
2 * Copyright (c) 2022-2024 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_hitrace_test.h"
17
18 using namespace testing::ext;
19
20 namespace OHOS {
21 namespace DistributedHardware {
SetUpTestCase(void)22 void DAudioHitraceTest::SetUpTestCase(void) {}
23
TearDownTestCase(void)24 void DAudioHitraceTest::TearDownTestCase(void) {}
25
SetUp()26 void DAudioHitraceTest::SetUp()
27 {
28 hitrace_ = std::make_shared<DAudioHitrace>("value", false, false);
29 hitrace_ = std::make_shared<DAudioHitrace>("value", true, false);
30 }
31
TearDown()32 void DAudioHitraceTest::TearDown()
33 {
34 hitrace_ = nullptr;
35 }
36
37 /**
38 * @tc.name: End_001
39 * @tc.desc: Verify the End function.
40 * @tc.type: FUNC
41 * @tc.require:
42 */
43 HWTEST_F(DAudioHitraceTest, End_001, TestSize.Level1)
44 {
45 ASSERT_TRUE(hitrace_ != nullptr);
46 std::string result = "123";
47 hitrace_->isFinished_ = false;
48 hitrace_->End();
49 hitrace_->isShowLog_ = false;
50 hitrace_->End();
51 hitrace_->isFinished_ = true;
52 hitrace_->End();
53 EXPECT_EQ(true, hitrace_->isFinished_);
54 }
55 } // DistributedHardware
56 } // OHOS
57