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 "fast_audio_stream.h" 21 22 using namespace testing::ext; 23 24 namespace OHOS { 25 namespace AudioStandard { 26 27 class FastSystemStreamUnitTest : public testing::Test { 28 public: 29 static void SetUpTestCase(void); 30 static void TearDownTestCase(void); 31 void SetUp(); 32 void TearDown(); 33 }; 34 35 class AudioClientTrackerTest : public AudioClientTracker { 36 public: 37 virtual ~AudioClientTrackerTest() = default; 38 /** 39 * Mute Stream was controlled by system application 40 * 41 * @param streamSetStateEventInternal Contains the set even information. 42 */ MuteStreamImpl(const StreamSetStateEventInternal & streamSetStateEventInternal)43 virtual void MuteStreamImpl(const StreamSetStateEventInternal &streamSetStateEventInternal) {}; 44 /** 45 * Unmute Stream was controlled by system application 46 * 47 * @param streamSetStateEventInternal Contains the set even information. 48 */ UnmuteStreamImpl(const StreamSetStateEventInternal & streamSetStateEventInternal)49 virtual void UnmuteStreamImpl(const StreamSetStateEventInternal &streamSetStateEventInternal) {}; 50 /** 51 * Paused Stream was controlled by system application 52 * 53 * @param streamSetStateEventInternal Contains the set even information. 54 */ PausedStreamImpl(const StreamSetStateEventInternal & streamSetStateEventInternal)55 virtual void PausedStreamImpl(const StreamSetStateEventInternal &streamSetStateEventInternal) {}; 56 /** 57 * Resumed Stream was controlled by system application 58 * 59 * @param streamSetStateEventInternal Contains the set even information. 60 */ ResumeStreamImpl(const StreamSetStateEventInternal & streamSetStateEventInternal)61 virtual void ResumeStreamImpl(const StreamSetStateEventInternal &streamSetStateEventInternal) {}; SetLowPowerVolumeImpl(float volume)62 virtual void SetLowPowerVolumeImpl(float volume) {}; GetLowPowerVolumeImpl(float & volume)63 virtual void GetLowPowerVolumeImpl(float &volume) {}; GetSingleStreamVolumeImpl(float & volume)64 virtual void GetSingleStreamVolumeImpl(float &volume) {}; SetOffloadModeImpl(int32_t state,bool isAppBack)65 virtual void SetOffloadModeImpl(int32_t state, bool isAppBack) {}; UnsetOffloadModeImpl()66 virtual void UnsetOffloadModeImpl() {}; 67 }; 68 69 /** 70 * @tc.name : Test GetVolume API 71 * @tc.type : FUNC 72 * @tc.number: GetVolume_001 73 * @tc.desc : Test GetVolume interface. 74 */ 75 HWTEST(FastSystemStreamUnitTest, GetVolume_001, TestSize.Level1) 76 { 77 int32_t appUid = static_cast<int32_t>(getuid()); 78 std::shared_ptr<FastAudioStream> fastAudioStream; 79 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 80 81 AUDIO_INFO_LOG("AudioSystemManagerUnitTest GetVolume_001 start"); 82 fastAudioStream->silentModeAndMixWithOthers_ = true; 83 float result = fastAudioStream->GetVolume(); 84 AUDIO_INFO_LOG("AudioSystemManagerUnitTest GetVolume_001 result:%{public}f", result); 85 EXPECT_GT(result, 0); 86 } 87 88 /** 89 * @tc.name : Test SetVolume API 90 * @tc.type : FUNC 91 * @tc.number: SetVolume_001 92 * @tc.desc : Test SetVolume interface. 93 */ 94 HWTEST(FastSystemStreamUnitTest, SetVolume_001, TestSize.Level1) 95 { 96 int32_t appUid = static_cast<int32_t>(getuid()); 97 std::shared_ptr<FastAudioStream> fastAudioStream; 98 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 99 100 float volume = 0.5f; 101 fastAudioStream->silentModeAndMixWithOthers_ = true; 102 int32_t result = fastAudioStream->SetVolume(volume); 103 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetVolume_001 result:%{public}d", result); 104 EXPECT_NE(result, ERROR); 105 } 106 107 /** 108 * @tc.name : Test SetSilentModeAndMixWithOthers API 109 * @tc.type : FUNC 110 * @tc.number: SetSilentModeAndMixWithOthers_001 111 * @tc.desc : Test SetSilentModeAndMixWithOthers interface. 112 */ 113 HWTEST(FastSystemStreamUnitTest, SetSilentModeAndMixWithOthers_001, TestSize.Level1) 114 { 115 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetSilentModeAndMixWithOthers_001 start"); 116 int32_t appUid = static_cast<int32_t>(getuid()); 117 std::shared_ptr<FastAudioStream> fastAudioStream; 118 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 119 120 bool on = false; 121 fastAudioStream->silentModeAndMixWithOthers_ = false; 122 fastAudioStream->SetSilentModeAndMixWithOthers(on); 123 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetSilentModeAndMixWithOthers_001 -1"); 124 fastAudioStream->silentModeAndMixWithOthers_ = true; 125 fastAudioStream->SetSilentModeAndMixWithOthers(on); 126 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetSilentModeAndMixWithOthers_001 -2"); 127 128 on = true; 129 fastAudioStream->silentModeAndMixWithOthers_ = false; 130 fastAudioStream->SetSilentModeAndMixWithOthers(on); 131 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetSilentModeAndMixWithOthers_001 -3"); 132 fastAudioStream->silentModeAndMixWithOthers_ = true; 133 fastAudioStream->SetSilentModeAndMixWithOthers(on); 134 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetSilentModeAndMixWithOthers_001 -4"); 135 } 136 137 /** 138 * @tc.name : Test GetSwitchInfo API 139 * @tc.type : FUNC 140 * @tc.number: GetSwitchInfo_001 141 * @tc.desc : Test GetSwitchInfo interface. 142 */ 143 HWTEST(FastSystemStreamUnitTest, GetSwitchInfo_001, TestSize.Level1) 144 { 145 AUDIO_INFO_LOG("AudioSystemManagerUnitTest GetSwitchInfo_001 start"); 146 int32_t appUid = static_cast<int32_t>(getuid()); 147 IAudioStream::SwitchInfo info; 148 std::shared_ptr<FastAudioStream> fastAudioStream; 149 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 150 fastAudioStream->GetSwitchInfo(info); 151 } 152 153 /** 154 * @tc.name : Test UpdatePlaybackCaptureConfig API 155 * @tc.type : FUNC 156 * @tc.number: UpdatePlaybackCaptureConfig_001 157 * @tc.desc : Test UpdatePlaybackCaptureConfig interface. 158 */ 159 HWTEST(FastSystemStreamUnitTest, UpdatePlaybackCaptureConfig_001, TestSize.Level1) 160 { 161 AUDIO_INFO_LOG("AudioSystemManagerUnitTest UpdatePlaybackCaptureConfig_001 start"); 162 int32_t appUid = static_cast<int32_t>(getuid()); 163 AudioPlaybackCaptureConfig config; 164 std::shared_ptr<FastAudioStream> fastAudioStream; 165 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 166 int32_t res = 0; 167 res = fastAudioStream->UpdatePlaybackCaptureConfig(config); 168 EXPECT_EQ(res, ERR_NOT_SUPPORTED); 169 } 170 171 /** 172 * @tc.name : Test GetAudioPipeType and SetAudioStreamType API 173 * @tc.type : FUNC 174 * @tc.number: GetAudioPipeType_001 175 * @tc.desc : Test GetAudioPipeType and SetAudioStreamType interface. 176 */ 177 HWTEST(FastSystemStreamUnitTest, GetAudioPipeType_001, TestSize.Level1) 178 { 179 AUDIO_INFO_LOG("AudioSystemManagerUnitTest GetAudioPipeType_001 start"); 180 int32_t appUid = static_cast<int32_t>(getuid()); 181 AudioPipeType pipeType; 182 std::shared_ptr<FastAudioStream> fastAudioStream; 183 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 184 fastAudioStream->GetAudioPipeType(pipeType); 185 AudioStreamType audioStreamType = STREAM_DEFAULT; 186 int32_t res = fastAudioStream->SetAudioStreamType(audioStreamType); 187 EXPECT_EQ(res, ERR_INVALID_OPERATION); 188 } 189 190 /** 191 * @tc.name : Test SetMute API 192 * @tc.type : FUNC 193 * @tc.number: SetMute_001 194 * @tc.desc : Test SetMute interface. 195 */ 196 HWTEST(FastSystemStreamUnitTest, SetMute_001, TestSize.Level1) 197 { 198 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetMute_001 start"); 199 int32_t appUid = static_cast<int32_t>(getuid()); 200 std::shared_ptr<FastAudioStream> fastAudioStream; 201 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 202 int32_t res = fastAudioStream->SetMute(false); 203 EXPECT_EQ(res, ERR_OPERATION_FAILED); 204 } 205 206 /** 207 * @tc.name : Test SetRenderMode and GetCaptureMode API 208 * @tc.type : FUNC 209 * @tc.number: SetRenderMode_001 210 * @tc.desc : Test SetRenderMode and GetCaptureMode interface. 211 */ 212 HWTEST(FastSystemStreamUnitTest, SetRenderMode_001, TestSize.Level1) 213 { 214 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetRenderMode_001 start"); 215 int32_t appUid = static_cast<int32_t>(getuid()); 216 std::shared_ptr<FastAudioStream> fastAudioStream; 217 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 218 AudioRenderMode renderMode = RENDER_MODE_CALLBACK; 219 int32_t res = fastAudioStream->SetRenderMode(renderMode); 220 EXPECT_EQ(res, SUCCESS); 221 } 222 223 /** 224 * @tc.name : Test GetCaptureMode API 225 * @tc.type : FUNC 226 * @tc.number: GetCaptureMode_001 227 * @tc.desc : Test GetCaptureMode interface. 228 */ 229 HWTEST(FastSystemStreamUnitTest, GetCaptureMode_001, TestSize.Level1) 230 { 231 AUDIO_INFO_LOG("AudioSystemManagerUnitTest GetCaptureMode_001 start"); 232 int32_t appUid = static_cast<int32_t>(getuid()); 233 std::shared_ptr<FastAudioStream> fastAudioStream; 234 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 235 AudioCaptureMode captureMode; 236 captureMode = fastAudioStream->GetCaptureMode(); 237 EXPECT_EQ(captureMode, CAPTURE_MODE_CALLBACK); 238 } 239 240 /** 241 * @tc.name : Test SetLowPowerVolume, GetLowPowerVolume and GetSingleStreamVolume API 242 * @tc.type : FUNC 243 * @tc.number: SetLowPowerVolume_001 244 * @tc.desc : Test SetLowPowerVolume, GetLowPowerVolume and GetSingleStreamVolume interface. 245 */ 246 HWTEST(FastSystemStreamUnitTest, SetLowPowerVolume_001, TestSize.Level1) 247 { 248 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetLowPowerVolume_001 start"); 249 int32_t appUid = static_cast<int32_t>(getuid()); 250 std::shared_ptr<FastAudioStream> fastAudioStream; 251 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 252 int32_t res = fastAudioStream->SetLowPowerVolume(1.0f); 253 EXPECT_EQ(res, SUCCESS); 254 float volume = fastAudioStream->GetLowPowerVolume(); 255 EXPECT_EQ(volume, 1.0f); 256 volume = fastAudioStream->GetSingleStreamVolume(); 257 EXPECT_EQ(volume, 1.0f); 258 } 259 260 /** 261 * @tc.name : Test SetOffloadMode and UnsetOffloadMode API 262 * @tc.type : FUNC 263 * @tc.number: SetOffloadMode_001 264 * @tc.desc : Test SetOffloadMode and UnsetOffloadMode interface. 265 */ 266 HWTEST(FastSystemStreamUnitTest, SetOffloadMode_001, TestSize.Level1) 267 { 268 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetOffloadMode_001 start"); 269 int32_t appUid = static_cast<int32_t>(getuid()); 270 std::shared_ptr<FastAudioStream> fastAudioStream; 271 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 272 int32_t res = fastAudioStream->SetOffloadMode(0, true); 273 EXPECT_EQ(res, ERR_NOT_SUPPORTED); 274 res = fastAudioStream->UnsetOffloadMode(); 275 EXPECT_EQ(res, ERR_NOT_SUPPORTED); 276 } 277 278 /** 279 * @tc.name : Test SetAudioEffectMode API 280 * @tc.type : FUNC 281 * @tc.number: SetAudioEffectMode_001 282 * @tc.desc : Test SetAudioEffectMode interface. 283 */ 284 HWTEST(FastSystemStreamUnitTest, SetAudioEffectMode_001, TestSize.Level1) 285 { 286 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetAudioEffectMode_001 start"); 287 int32_t appUid = static_cast<int32_t>(getuid()); 288 std::shared_ptr<FastAudioStream> fastAudioStream; 289 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 290 AudioEffectMode effectMode = EFFECT_NONE; 291 int32_t res = fastAudioStream->SetAudioEffectMode(effectMode); 292 EXPECT_EQ(res, ERR_NOT_SUPPORTED); 293 } 294 295 /** 296 * @tc.name : Test GetFramesWritten and GetFramesRead API 297 * @tc.type : FUNC 298 * @tc.number: GetFramesWritten_001 299 * @tc.desc : Test GetFramesWritten and GetFramesRead interface. 300 */ 301 HWTEST(FastSystemStreamUnitTest, GetFramesWritten_001, TestSize.Level1) 302 { 303 AUDIO_INFO_LOG("AudioSystemManagerUnitTest GetFramesWritten_001 start"); 304 int32_t appUid = static_cast<int32_t>(getuid()); 305 std::shared_ptr<FastAudioStream> fastAudioStream; 306 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 307 int32_t res = fastAudioStream->GetFramesWritten(); 308 EXPECT_EQ(res, -1); 309 res = fastAudioStream->GetFramesRead(); 310 EXPECT_EQ(res, -1); 311 } 312 313 /** 314 * @tc.name : Test SetSpeed and GetSpeed API 315 * @tc.type : FUNC 316 * @tc.number: SetSpeed_001 317 * @tc.desc : Test SetSpeed and GetSpeed interface. 318 */ 319 HWTEST(FastSystemStreamUnitTest, SetSpeed_001, TestSize.Level1) 320 { 321 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetSpeed_001 start"); 322 int32_t appUid = static_cast<int32_t>(getuid()); 323 std::shared_ptr<FastAudioStream> fastAudioStream; 324 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 325 int32_t res = fastAudioStream->SetSpeed(1.0f); 326 EXPECT_EQ(res, ERR_OPERATION_FAILED); 327 float ret = fastAudioStream->GetSpeed(); 328 EXPECT_EQ(ret, static_cast<float>(ERROR)); 329 } 330 331 /** 332 * @tc.name : Test FlushAudioStream and DrainAudioStream API 333 * @tc.type : FUNC 334 * @tc.number: SetSpeed_001 335 * @tc.desc : Test FlushAudioStream and DrainAudioStream interface. 336 */ 337 HWTEST(FastSystemStreamUnitTest, FlushAudioStream_001, TestSize.Level1) 338 { 339 AUDIO_INFO_LOG("AudioSystemManagerUnitTest FlushAudioStream_001 start"); 340 int32_t appUid = static_cast<int32_t>(getuid()); 341 std::shared_ptr<FastAudioStream> fastAudioStream; 342 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 343 bool res = fastAudioStream->FlushAudioStream(); 344 EXPECT_EQ(res, true); 345 res = fastAudioStream->DrainAudioStream(true); 346 EXPECT_EQ(res, true); 347 } 348 349 /** 350 * @tc.name : Test callbacks and samplingrate API 351 * @tc.type : FUNC 352 * @tc.number: SetAndGetCallback_001 353 * @tc.desc : Test callbacks and samplingrate interface. 354 */ 355 HWTEST(FastSystemStreamUnitTest, SetAndGetCallback_001, TestSize.Level1) 356 { 357 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetAndGetCallback_001 start"); 358 int32_t appUid = static_cast<int32_t>(getuid()); 359 std::shared_ptr<FastAudioStream> fastAudioStream; 360 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 361 362 std::shared_ptr<RendererPeriodPositionCallback> rendererPeriodPositionCallback = nullptr; 363 fastAudioStream->SetRendererPeriodPositionCallback(0, rendererPeriodPositionCallback); 364 fastAudioStream->UnsetRendererPeriodPositionCallback(); 365 366 std::shared_ptr<CapturerPositionCallback> capturerPositionCallback = nullptr; 367 fastAudioStream->SetCapturerPositionCallback(0, capturerPositionCallback); 368 fastAudioStream->UnsetCapturerPositionCallback(); 369 370 std::shared_ptr<CapturerPeriodPositionCallback> capturerPeriodPositionCallback = nullptr; 371 fastAudioStream->SetCapturerPeriodPositionCallback(0, capturerPeriodPositionCallback); 372 fastAudioStream->UnsetCapturerPeriodPositionCallback(); 373 374 int32_t res = fastAudioStream->SetRendererSamplingRate(0); 375 EXPECT_EQ(res, ERR_OPERATION_FAILED); 376 377 uint32_t samplingRate = fastAudioStream->streamInfo_.samplingRate; 378 uint32_t rate = fastAudioStream->GetRendererSamplingRate(); 379 EXPECT_EQ(rate, samplingRate); 380 } 381 382 /** 383 * @tc.name : Test SetAudioStreamInfo API 384 * @tc.type : FUNC 385 * @tc.number: SetAudioStreamInfo_001 386 * @tc.desc : Test SetAudioStreamInfo interface. 387 */ 388 HWTEST(FastSystemStreamUnitTest, SetAudioStreamInfo_001, TestSize.Level1) 389 { 390 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetAudioStreamInfo_001 start"); 391 int32_t appUid = static_cast<int32_t>(getuid()); 392 std::shared_ptr<FastAudioStream> fastAudioStream; 393 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 394 std::shared_ptr<AudioClientTracker> proxyObj; 395 fastAudioStream->state_ = PREPARED; 396 AudioStreamParams info; 397 int32_t res = fastAudioStream->SetAudioStreamInfo(info, proxyObj); 398 EXPECT_EQ(res, ERR_INVALID_PARAM); 399 } 400 401 /** 402 * @tc.name : Test SetAudioStreamInfo API 403 * @tc.type : FUNC 404 * @tc.number: SetAudioStreamInfo_002 405 * @tc.desc : Test SetAudioStreamInfo interface. 406 */ 407 HWTEST(FastSystemStreamUnitTest, SetAudioStreamInfo_002, TestSize.Level1) 408 { 409 AUDIO_INFO_LOG("AudioSystemManagerUnitTest SetAudioStreamInfo_002 start"); 410 int32_t appUid = static_cast<int32_t>(getuid()); 411 std::shared_ptr<FastAudioStream> fastAudioStream; 412 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 413 std::shared_ptr<AudioClientTracker> proxyObj; 414 AudioStreamParams info; 415 info.format = AudioSampleFormat::SAMPLE_S16LE; 416 info.encoding = AudioEncodingType::ENCODING_PCM; 417 info.samplingRate = AudioSamplingRate::SAMPLE_RATE_48000; 418 info.channels = AudioChannel::MONO; 419 info.channelLayout = AudioChannelLayout::CH_LAYOUT_MONO; 420 int32_t res = fastAudioStream->SetAudioStreamInfo(info, proxyObj); 421 EXPECT_NE(res, SUCCESS); 422 bool result = false; 423 fastAudioStream->RestoreAudioStream(true); 424 EXPECT_EQ(result, false); 425 } 426 427 /** 428 * @tc.name : Test RestoreAudioStream API 429 * @tc.type : FUNC 430 * @tc.number: RestoreAudioStream_001 431 * @tc.desc : Test RestoreAudioStream interface. 432 */ 433 HWTEST(FastSystemStreamUnitTest, RestoreAudioStream_001, TestSize.Level1) 434 { 435 AUDIO_INFO_LOG("AudioSystemManagerUnitTest RestoreAudioStream_001 start"); 436 int32_t appUid = static_cast<int32_t>(getuid()); 437 std::shared_ptr<FastAudioStream> fastAudioStream; 438 fastAudioStream = std::make_shared<FastAudioStream>(STREAM_MUSIC, AUDIO_MODE_PLAYBACK, appUid); 439 bool result = false; 440 AudioStreamParams info; 441 info.format = AudioSampleFormat::SAMPLE_S16LE; 442 info.encoding = AudioEncodingType::ENCODING_PCM; 443 info.samplingRate = AudioSamplingRate::SAMPLE_RATE_48000; 444 info.channels = AudioChannel::MONO; 445 info.channelLayout = AudioChannelLayout::CH_LAYOUT_MONO; 446 std::shared_ptr<AudioClientTracker> proxyObj = std::make_shared<AudioClientTrackerTest>(); 447 fastAudioStream->proxyObj_ = proxyObj; 448 fastAudioStream->streamInfo_ = info; 449 fastAudioStream->state_ = RUNNING; 450 result = fastAudioStream->SetAudioStreamInfo(info, proxyObj); 451 EXPECT_EQ(result, true); 452 fastAudioStream->state_ = PAUSED; 453 result = fastAudioStream->SetAudioStreamInfo(info, proxyObj); 454 EXPECT_EQ(result, true); 455 fastAudioStream->state_ = STOPPED; 456 result = fastAudioStream->SetAudioStreamInfo(info, proxyObj); 457 EXPECT_EQ(result, true); 458 fastAudioStream->state_ = STOPPING; 459 result = fastAudioStream->SetAudioStreamInfo(info, proxyObj); 460 EXPECT_EQ(result, true); 461 fastAudioStream->state_ = INVALID; 462 result = fastAudioStream->SetAudioStreamInfo(info, proxyObj); 463 EXPECT_EQ(result, true); 464 } 465 } // namespace AudioStandard 466 } // namespace OHOS