• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "audio_service_log.h"
19 #include "audio_errors.h"
20 #include "audio_stream_manager.h"
21 
22 using namespace testing::ext;
23 
24 namespace OHOS {
25 namespace AudioStandard {
26 
27 class AudioSteamManagerUnitTest : public testing::Test {
28 public:
29     static void SetUpTestCase(void);
30     static void TearDownTestCase(void);
31     void SetUp();
32     void TearDown();
33 };
34 
35 /**
36  * @tc.name  : Test IsStreamActive API
37  * @tc.type  : FUNC
38  * @tc.number: IsStreamActive_001
39  * @tc.desc  : Test IsStreamActive interface.
40  */
41 HWTEST(AudioStreamManagerUnitTest, IsStreamActive_001, TestSize.Level1)
42 {
43     AUDIO_INFO_LOG("AudioSystemManagerUnitTest IsStreamActive_001 start");
44     bool result = AudioStreamManager::GetInstance()->IsStreamActive(STREAM_MUSIC);
45     AUDIO_INFO_LOG("AudioSystemManagerUnitTest IsStreamActive_001 result1:%{public}d", result);
46     EXPECT_EQ(result, false);
47 
48     result = AudioStreamManager::GetInstance()->IsStreamActive(STREAM_VOICE_ASSISTANT);
49     AUDIO_INFO_LOG("AudioSystemManagerUnitTest IsStreamActive_001 result2:%{public}d", result);
50     EXPECT_EQ(result, false);
51 
52     result = AudioStreamManager::GetInstance()->IsStreamActive(STREAM_ULTRASONIC);
53     AUDIO_INFO_LOG("AudioSystemManagerUnitTest IsStreamActive_001 result2:%{public}d", result);
54     EXPECT_EQ(result, false);
55 
56     result = AudioStreamManager::GetInstance()->IsStreamActive(STREAM_ALL);
57     AUDIO_INFO_LOG("AudioSystemManagerUnitTest IsStreamActive_001 result3:%{public}d", result);
58     EXPECT_EQ(result, false);
59 }
60 } // namespace AudioStandard
61 } // namespace OHOS