1 /*
2  * Copyright (c) 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 <gtest/gtest.h>
17 
18 #include "avsession_sysevent.h"
19 
20 using namespace OHOS;
21 using namespace OHOS::AVSession;
22 
23 class AVsessionSyseventTest : public testing::Test {
24 public:
25     static void SetUpTestCase(void);
26     static void TearDownTestCase(void);
27     void SetUp();
28     void TearDown();
29 };
30 
SetUpTestCase()31 void AVsessionSyseventTest::SetUpTestCase()
32 {}
33 
TearDownTestCase()34 void AVsessionSyseventTest::TearDownTestCase()
35 {}
36 
SetUp()37 void AVsessionSyseventTest::SetUp()
38 {}
39 
TearDown()40 void AVsessionSyseventTest::TearDown()
41 {}
42 
43 #ifdef ENABLE_AVSESSION_SYSEVENT_CONTROL
44 /**
45 * @tc.name: Regiter001
46 * @tc.desc: test Regiter
47 * @tc.type: FUNC
48 * @tc.require:
49 */
HWTEST_F(AVsessionSyseventTest, Regiter001, testing::ext::TestSize.Level1)50 static HWTEST_F(AVsessionSyseventTest, Regiter001, testing::ext::TestSize.Level1)
51 {
52     AVSessionSysEvent::GetInstance().Unregister();
53     EXPECT_EQ(AVSessionSysEvent::GetInstance().timer_, nullptr);
54     AVSessionSysEvent::GetInstance().Regiter();
55     AVSessionSysEvent::GetInstance().Regiter();
56     AVSessionSysEvent::GetInstance().Unregister();
57 }
58 #endif