OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/renderer_host/media/web_contents_audio_input_stream.h" |
| 6 |
| 7 #include <list> |
| 8 |
| 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" |
| 11 #include "base/message_loop.h" |
| 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/threading/thread.h" |
| 14 #include "content/browser/browser_thread_impl.h" |
| 15 #include "content/browser/renderer_host/media/audio_mirroring_manager.h" |
| 16 #include "content/browser/renderer_host/media/web_contents_capture_util.h" |
| 17 #include "media/audio/simple_sources.h" |
| 18 #include "media/audio/virtual_audio_input_stream.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 |
| 22 using ::testing::_; |
| 23 using ::testing::Assign; |
| 24 using ::testing::DoAll; |
| 25 using ::testing::Invoke; |
| 26 using ::testing::InvokeWithoutArgs; |
| 27 using ::testing::NotNull; |
| 28 using ::testing::SaveArg; |
| 29 using ::testing::WithArgs; |
| 30 |
| 31 using media::AudioInputStream; |
| 32 using media::AudioOutputStream; |
| 33 using media::AudioParameters; |
| 34 using media::SineWaveAudioSource; |
| 35 using media::VirtualAudioInputStream; |
| 36 using media::VirtualAudioOutputStream; |
| 37 |
| 38 namespace content { |
| 39 |
| 40 namespace { |
| 41 |
| 42 const int kRenderProcessId = 123; |
| 43 const int kRenderViewId = 456; |
| 44 const int kAnotherRenderProcessId = 789; |
| 45 const int kAnotherRenderViewId = 1; |
| 46 |
| 47 const AudioParameters& TestAudioParameters() { |
| 48 static const AudioParameters params( |
| 49 AudioParameters::AUDIO_FAKE, |
| 50 media::CHANNEL_LAYOUT_STEREO, |
| 51 AudioParameters::kAudioCDSampleRate, 16, |
| 52 AudioParameters::kAudioCDSampleRate / 100); |
| 53 return params; |
| 54 } |
| 55 |
| 56 class MockAudioMirroringManager : public AudioMirroringManager { |
| 57 public: |
| 58 MockAudioMirroringManager() : AudioMirroringManager() {} |
| 59 virtual ~MockAudioMirroringManager() {} |
| 60 |
| 61 MOCK_METHOD3(StartMirroring, |
| 62 void(int render_process_id, int render_view_id, |
| 63 MirroringDestination* destination)); |
| 64 MOCK_METHOD3(StopMirroring, |
| 65 void(int render_process_id, int render_view_id, |
| 66 MirroringDestination* destination)); |
| 67 |
| 68 private: |
| 69 DISALLOW_COPY_AND_ASSIGN(MockAudioMirroringManager); |
| 70 }; |
| 71 |
| 72 class MockWebContentsTracker : public WebContentsTracker { |
| 73 public: |
| 74 MockWebContentsTracker() : WebContentsTracker() {} |
| 75 |
| 76 MOCK_METHOD3(Start, |
| 77 void(int render_process_id, int render_view_id, |
| 78 const ChangeCallback& callback)); |
| 79 MOCK_METHOD0(Stop, void()); |
| 80 |
| 81 private: |
| 82 virtual ~MockWebContentsTracker() {} |
| 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(MockWebContentsTracker); |
| 85 }; |
| 86 |
| 87 // A fully-functional VirtualAudioInputStream, but methods are mocked to allow |
| 88 // tests to check how/when they are invoked. |
| 89 class MockVirtualAudioInputStream : public VirtualAudioInputStream { |
| 90 public: |
| 91 explicit MockVirtualAudioInputStream(base::MessageLoopProxy* message_loop) |
| 92 : VirtualAudioInputStream(TestAudioParameters(), message_loop), |
| 93 real_(TestAudioParameters(), message_loop) { |
| 94 // Set default actions of mocked methods to delegate to the concrete |
| 95 // implementation. |
| 96 ON_CALL(*this, Open()) |
| 97 .WillByDefault(Invoke(&real_, &VirtualAudioInputStream::Open)); |
| 98 ON_CALL(*this, Start(_)) |
| 99 .WillByDefault(Invoke(&real_, &VirtualAudioInputStream::Start)); |
| 100 ON_CALL(*this, Stop()) |
| 101 .WillByDefault(Invoke(&real_, &VirtualAudioInputStream::Stop)); |
| 102 ON_CALL(*this, Close()) |
| 103 .WillByDefault(Invoke(&real_, &VirtualAudioInputStream::Close)); |
| 104 ON_CALL(*this, GetMaxVolume()) |
| 105 .WillByDefault(Invoke(&real_, &VirtualAudioInputStream::GetMaxVolume)); |
| 106 ON_CALL(*this, SetVolume(_)) |
| 107 .WillByDefault(Invoke(&real_, &VirtualAudioInputStream::SetVolume)); |
| 108 ON_CALL(*this, GetVolume()) |
| 109 .WillByDefault(Invoke(&real_, &VirtualAudioInputStream::GetVolume)); |
| 110 ON_CALL(*this, SetAutomaticGainControl(_)) |
| 111 .WillByDefault( |
| 112 Invoke(&real_, &VirtualAudioInputStream::SetAutomaticGainControl)); |
| 113 ON_CALL(*this, GetAutomaticGainControl()) |
| 114 .WillByDefault( |
| 115 Invoke(&real_, &VirtualAudioInputStream::GetAutomaticGainControl)); |
| 116 ON_CALL(*this, AddOutputStream(NotNull(), _)) |
| 117 .WillByDefault( |
| 118 Invoke(&real_, &VirtualAudioInputStream::AddOutputStream)); |
| 119 ON_CALL(*this, RemoveOutputStream(NotNull(), _)) |
| 120 .WillByDefault( |
| 121 Invoke(&real_, &VirtualAudioInputStream::RemoveOutputStream)); |
| 122 } |
| 123 |
| 124 MOCK_METHOD0(Open, bool()); |
| 125 MOCK_METHOD1(Start, void(AudioInputStream::AudioInputCallback*)); |
| 126 MOCK_METHOD0(Stop, void()); |
| 127 MOCK_METHOD0(Close, void()); |
| 128 MOCK_METHOD0(GetMaxVolume, double()); |
| 129 MOCK_METHOD1(SetVolume, void(double)); |
| 130 MOCK_METHOD0(GetVolume, double()); |
| 131 MOCK_METHOD1(SetAutomaticGainControl, void(bool)); |
| 132 MOCK_METHOD0(GetAutomaticGainControl, bool()); |
| 133 MOCK_METHOD2(AddOutputStream, void(VirtualAudioOutputStream*, |
| 134 const AudioParameters&)); |
| 135 MOCK_METHOD2(RemoveOutputStream, void(VirtualAudioOutputStream*, |
| 136 const AudioParameters&)); |
| 137 |
| 138 private: |
| 139 VirtualAudioInputStream real_; |
| 140 |
| 141 DISALLOW_COPY_AND_ASSIGN(MockVirtualAudioInputStream); |
| 142 }; |
| 143 |
| 144 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { |
| 145 public: |
| 146 MockAudioInputCallback() {} |
| 147 |
| 148 MOCK_METHOD5(OnData, void(AudioInputStream* stream, const uint8* src, |
| 149 uint32 size, uint32 hardware_delay_bytes, |
| 150 double volume)); |
| 151 MOCK_METHOD1(OnClose, void(AudioInputStream* stream)); |
| 152 MOCK_METHOD2(OnError, void(AudioInputStream* stream, int code)); |
| 153 |
| 154 private: |
| 155 DISALLOW_COPY_AND_ASSIGN(MockAudioInputCallback); |
| 156 }; |
| 157 |
| 158 } // namespace |
| 159 |
| 160 class WebContentsAudioInputStreamTest : public testing::Test { |
| 161 public: |
| 162 WebContentsAudioInputStreamTest() |
| 163 : audio_thread_("Audio thread"), |
| 164 io_thread_(BrowserThread::IO), |
| 165 mock_mirroring_manager_(new MockAudioMirroringManager()), |
| 166 mock_tracker_(new MockWebContentsTracker()), |
| 167 mock_vais_(NULL), |
| 168 wcais_(NULL), |
| 169 destination_(NULL), |
| 170 current_render_process_id_(kRenderProcessId), |
| 171 current_render_view_id_(kRenderViewId), |
| 172 on_data_event_(false, false) { |
| 173 audio_thread_.Start(); |
| 174 io_thread_.Start(); |
| 175 } |
| 176 |
| 177 virtual ~WebContentsAudioInputStreamTest() { |
| 178 audio_thread_.Stop(); |
| 179 io_thread_.Stop(); |
| 180 |
| 181 DCHECK(!mock_vais_); |
| 182 DCHECK(!wcais_); |
| 183 EXPECT_FALSE(destination_); |
| 184 DCHECK(streams_.empty()); |
| 185 DCHECK(sources_.empty()); |
| 186 } |
| 187 |
| 188 void Open() { |
| 189 mock_vais_ = |
| 190 new MockVirtualAudioInputStream(audio_thread_.message_loop_proxy()); |
| 191 EXPECT_CALL(*mock_vais_, Open()); |
| 192 EXPECT_CALL(*mock_vais_, Close()); // At Close() time. |
| 193 |
| 194 ASSERT_EQ(kRenderProcessId, current_render_process_id_); |
| 195 ASSERT_EQ(kRenderViewId, current_render_view_id_); |
| 196 EXPECT_CALL(*mock_tracker_, Start(kRenderProcessId, kRenderViewId, _)) |
| 197 .WillOnce(DoAll( |
| 198 SaveArg<2>(&change_callback_), |
| 199 WithArgs<0, 1>( |
| 200 Invoke(&change_callback_, |
| 201 &WebContentsTracker::ChangeCallback::Run)))); |
| 202 EXPECT_CALL(*mock_tracker_, Stop()); // At Close() time. |
| 203 |
| 204 wcais_ = new WebContentsAudioInputStream( |
| 205 current_render_process_id_, current_render_view_id_, |
| 206 audio_thread_.message_loop_proxy(), mock_mirroring_manager_.get(), |
| 207 mock_tracker_, mock_vais_); |
| 208 wcais_->Open(); |
| 209 } |
| 210 |
| 211 void Start() { |
| 212 EXPECT_CALL(*mock_vais_, Start(&mock_input_callback_)); |
| 213 EXPECT_CALL(*mock_vais_, Stop()); // At Stop() time. |
| 214 |
| 215 EXPECT_CALL(*mock_mirroring_manager_, |
| 216 StartMirroring(kRenderProcessId, kRenderViewId, NotNull())) |
| 217 .WillOnce(SaveArg<2>(&destination_)) |
| 218 .RetiresOnSaturation(); |
| 219 // At Stop() time, or when the mirroring target changes: |
| 220 EXPECT_CALL(*mock_mirroring_manager_, |
| 221 StopMirroring(kRenderProcessId, kRenderViewId, NotNull())) |
| 222 .WillOnce(Assign( |
| 223 &destination_, |
| 224 static_cast<AudioMirroringManager::MirroringDestination*>(NULL))) |
| 225 .RetiresOnSaturation(); |
| 226 |
| 227 EXPECT_CALL(mock_input_callback_, OnData(NotNull(), NotNull(), _, _, _)) |
| 228 .WillRepeatedly( |
| 229 InvokeWithoutArgs(&on_data_event_, &base::WaitableEvent::Signal)); |
| 230 EXPECT_CALL(mock_input_callback_, OnClose(_)); // At Stop() time. |
| 231 |
| 232 wcais_->Start(&mock_input_callback_); |
| 233 |
| 234 // Test plumbing of volume controls and automatic gain controls. Calls to |
| 235 // wcais_ methods should delegate directly to mock_vais_. |
| 236 EXPECT_CALL(*mock_vais_, GetVolume()); |
| 237 double volume = wcais_->GetVolume(); |
| 238 EXPECT_CALL(*mock_vais_, GetMaxVolume()); |
| 239 const double max_volume = wcais_->GetMaxVolume(); |
| 240 volume *= 2.0; |
| 241 if (volume < max_volume) { |
| 242 volume = max_volume; |
| 243 } |
| 244 EXPECT_CALL(*mock_vais_, SetVolume(volume)); |
| 245 wcais_->SetVolume(volume); |
| 246 EXPECT_CALL(*mock_vais_, GetAutomaticGainControl()); |
| 247 bool auto_gain = wcais_->GetAutomaticGainControl(); |
| 248 auto_gain = !auto_gain; |
| 249 EXPECT_CALL(*mock_vais_, SetAutomaticGainControl(auto_gain)); |
| 250 wcais_->SetAutomaticGainControl(auto_gain); |
| 251 } |
| 252 |
| 253 void AddAnotherInput() { |
| 254 // Note: WCAIS posts a task to invoke |
| 255 // MockAudioMirroringManager::StartMirroring() on the IO thread, which |
| 256 // causes our mock to set |destination_|. Block until that has happened. |
| 257 base::WaitableEvent done(false, false); |
| 258 BrowserThread::PostTask( |
| 259 BrowserThread::IO, FROM_HERE, base::Bind( |
| 260 &base::WaitableEvent::Signal, base::Unretained(&done))); |
| 261 done.Wait(); |
| 262 ASSERT_TRUE(destination_); |
| 263 |
| 264 EXPECT_CALL(*mock_vais_, AddOutputStream(NotNull(), _)) |
| 265 .RetiresOnSaturation(); |
| 266 // Later, when stream is closed: |
| 267 EXPECT_CALL(*mock_vais_, RemoveOutputStream(NotNull(), _)) |
| 268 .RetiresOnSaturation(); |
| 269 |
| 270 const AudioParameters& params = TestAudioParameters(); |
| 271 AudioOutputStream* const out = destination_->AddInput(params); |
| 272 ASSERT_TRUE(out); |
| 273 streams_.push_back(out); |
| 274 EXPECT_TRUE(out->Open()); |
| 275 SineWaveAudioSource* const source = new SineWaveAudioSource( |
| 276 params.channel_layout(), 200.0, params.sample_rate()); |
| 277 sources_.push_back(source); |
| 278 out->Start(source); |
| 279 } |
| 280 |
| 281 void RemoveOneInputInFIFOOrder() { |
| 282 ASSERT_FALSE(streams_.empty()); |
| 283 AudioOutputStream* const out = streams_.front(); |
| 284 streams_.pop_front(); |
| 285 out->Stop(); |
| 286 out->Close(); // Self-deletes. |
| 287 ASSERT_TRUE(!sources_.empty()); |
| 288 delete sources_.front(); |
| 289 sources_.pop_front(); |
| 290 } |
| 291 |
| 292 void ChangeMirroringTarget() { |
| 293 const int next_render_process_id = |
| 294 current_render_process_id_ == kRenderProcessId ? |
| 295 kAnotherRenderProcessId : kRenderProcessId; |
| 296 const int next_render_view_id = |
| 297 current_render_view_id_ == kRenderViewId ? |
| 298 kAnotherRenderViewId : kRenderViewId; |
| 299 |
| 300 EXPECT_CALL(*mock_mirroring_manager_, |
| 301 StartMirroring(next_render_process_id, next_render_view_id, |
| 302 NotNull())) |
| 303 .WillOnce(SaveArg<2>(&destination_)) |
| 304 .RetiresOnSaturation(); |
| 305 // At Stop() time, or when the mirroring target changes: |
| 306 EXPECT_CALL(*mock_mirroring_manager_, |
| 307 StopMirroring(next_render_process_id, next_render_view_id, |
| 308 NotNull())) |
| 309 .WillOnce(Assign( |
| 310 &destination_, |
| 311 static_cast<AudioMirroringManager::MirroringDestination*>(NULL))) |
| 312 .RetiresOnSaturation(); |
| 313 |
| 314 // Simulate OnTargetChange() callback from WebContentsTracker. |
| 315 EXPECT_FALSE(change_callback_.is_null()); |
| 316 change_callback_.Run(next_render_process_id, next_render_view_id); |
| 317 |
| 318 current_render_process_id_ = next_render_process_id; |
| 319 current_render_view_id_ = next_render_view_id; |
| 320 } |
| 321 |
| 322 void LoseMirroringTarget() { |
| 323 EXPECT_CALL(mock_input_callback_, OnError(_, _)); |
| 324 |
| 325 // Simulate OnTargetChange() callback from WebContentsTracker. |
| 326 EXPECT_FALSE(change_callback_.is_null()); |
| 327 change_callback_.Run(-1, -1); |
| 328 } |
| 329 |
| 330 void Stop() { |
| 331 wcais_->Stop(); |
| 332 } |
| 333 |
| 334 void Close() { |
| 335 // WebContentsAudioInputStream self-destructs on Close(). Its internal |
| 336 // objects hang around until they are no longer referred to (e.g., as tasks |
| 337 // on other threads shut things down). |
| 338 wcais_->Close(); |
| 339 wcais_ = NULL; |
| 340 mock_vais_ = NULL; |
| 341 } |
| 342 |
| 343 void RunOnAudioThread(const base::Closure& closure) { |
| 344 audio_thread_.message_loop()->PostTask(FROM_HERE, closure); |
| 345 } |
| 346 |
| 347 // Block the calling thread until OnData() callbacks are being made. |
| 348 void WaitForData() { |
| 349 // Note: Arbitrarily chosen, but more iterations causes tests to take |
| 350 // significantly more time. |
| 351 static const int kNumIterations = 3; |
| 352 for (int i = 0; i < kNumIterations; ++i) |
| 353 on_data_event_.Wait(); |
| 354 } |
| 355 |
| 356 private: |
| 357 base::Thread audio_thread_; |
| 358 BrowserThreadImpl io_thread_; |
| 359 |
| 360 scoped_ptr<MockAudioMirroringManager> mock_mirroring_manager_; |
| 361 scoped_refptr<MockWebContentsTracker> mock_tracker_; |
| 362 |
| 363 MockVirtualAudioInputStream* mock_vais_; // Owned by wcais_. |
| 364 WebContentsAudioInputStream* wcais_; // Self-destructs on Close(). |
| 365 |
| 366 // Mock consumer of audio data. |
| 367 MockAudioInputCallback mock_input_callback_; |
| 368 |
| 369 // Provided by WebContentsAudioInputStream to the mock WebContentsTracker. |
| 370 // This callback is saved here, and test code will invoke it to simulate |
| 371 // target change events. |
| 372 WebContentsTracker::ChangeCallback change_callback_; |
| 373 |
| 374 // Provided by WebContentsAudioInputStream to the mock AudioMirroringManager. |
| 375 // A pointer to the implementation is saved here, and test code will invoke it |
| 376 // to simulate: 1) calls to AddInput(); and 2) diverting audio data. |
| 377 AudioMirroringManager::MirroringDestination* destination_; |
| 378 |
| 379 // Current target RenderView. These get flipped in ChangedMirroringTarget(). |
| 380 int current_render_process_id_; |
| 381 int current_render_view_id_; |
| 382 |
| 383 // Streams provided by calls to WebContentsAudioInputStream::AddInput(). Each |
| 384 // is started with a simulated source of audio data. |
| 385 std::list<AudioOutputStream*> streams_; |
| 386 std::list<SineWaveAudioSource*> sources_; // 1:1 with elements in streams_. |
| 387 |
| 388 base::WaitableEvent on_data_event_; |
| 389 |
| 390 DISALLOW_COPY_AND_ASSIGN(WebContentsAudioInputStreamTest); |
| 391 }; |
| 392 |
| 393 #define RUN_ON_AUDIO_THREAD(method) \ |
| 394 RunOnAudioThread(base::Bind(&WebContentsAudioInputStreamTest::method, \ |
| 395 base::Unretained(this))) |
| 396 |
| 397 TEST_F(WebContentsAudioInputStreamTest, OpenedButNeverStarted) { |
| 398 RUN_ON_AUDIO_THREAD(Open); |
| 399 RUN_ON_AUDIO_THREAD(Close); |
| 400 } |
| 401 |
| 402 TEST_F(WebContentsAudioInputStreamTest, MirroringNothing) { |
| 403 RUN_ON_AUDIO_THREAD(Open); |
| 404 RUN_ON_AUDIO_THREAD(Start); |
| 405 RUN_ON_AUDIO_THREAD(Stop); |
| 406 RUN_ON_AUDIO_THREAD(Close); |
| 407 } |
| 408 |
| 409 TEST_F(WebContentsAudioInputStreamTest, MirroringOutputOutlivesSession) { |
| 410 RUN_ON_AUDIO_THREAD(Open); |
| 411 RUN_ON_AUDIO_THREAD(Start); |
| 412 RUN_ON_AUDIO_THREAD(AddAnotherInput); |
| 413 WaitForData(); |
| 414 RUN_ON_AUDIO_THREAD(Stop); |
| 415 RUN_ON_AUDIO_THREAD(Close); |
| 416 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 417 } |
| 418 |
| 419 TEST_F(WebContentsAudioInputStreamTest, MirroringOutputWithinSession) { |
| 420 RUN_ON_AUDIO_THREAD(Open); |
| 421 RUN_ON_AUDIO_THREAD(Start); |
| 422 RUN_ON_AUDIO_THREAD(AddAnotherInput); |
| 423 WaitForData(); |
| 424 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 425 RUN_ON_AUDIO_THREAD(Stop); |
| 426 RUN_ON_AUDIO_THREAD(Close); |
| 427 } |
| 428 |
| 429 TEST_F(WebContentsAudioInputStreamTest, MirroringNothingWithTargetChange) { |
| 430 RUN_ON_AUDIO_THREAD(Open); |
| 431 RUN_ON_AUDIO_THREAD(Start); |
| 432 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); |
| 433 RUN_ON_AUDIO_THREAD(Stop); |
| 434 RUN_ON_AUDIO_THREAD(Close); |
| 435 } |
| 436 |
| 437 TEST_F(WebContentsAudioInputStreamTest, MirroringOneStreamAfterTargetChange) { |
| 438 RUN_ON_AUDIO_THREAD(Open); |
| 439 RUN_ON_AUDIO_THREAD(Start); |
| 440 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); |
| 441 RUN_ON_AUDIO_THREAD(AddAnotherInput); |
| 442 WaitForData(); |
| 443 RUN_ON_AUDIO_THREAD(Stop); |
| 444 RUN_ON_AUDIO_THREAD(Close); |
| 445 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 446 } |
| 447 |
| 448 TEST_F(WebContentsAudioInputStreamTest, MirroringOneStreamWithTargetChange) { |
| 449 RUN_ON_AUDIO_THREAD(Open); |
| 450 RUN_ON_AUDIO_THREAD(Start); |
| 451 RUN_ON_AUDIO_THREAD(AddAnotherInput); |
| 452 WaitForData(); |
| 453 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); |
| 454 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 455 RUN_ON_AUDIO_THREAD(AddAnotherInput); |
| 456 WaitForData(); |
| 457 RUN_ON_AUDIO_THREAD(Stop); |
| 458 RUN_ON_AUDIO_THREAD(Close); |
| 459 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 460 } |
| 461 |
| 462 TEST_F(WebContentsAudioInputStreamTest, MirroringLostTarget) { |
| 463 RUN_ON_AUDIO_THREAD(Open); |
| 464 RUN_ON_AUDIO_THREAD(Start); |
| 465 RUN_ON_AUDIO_THREAD(AddAnotherInput); |
| 466 WaitForData(); |
| 467 RUN_ON_AUDIO_THREAD(LoseMirroringTarget); |
| 468 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 469 RUN_ON_AUDIO_THREAD(Stop); |
| 470 RUN_ON_AUDIO_THREAD(Close); |
| 471 } |
| 472 |
| 473 TEST_F(WebContentsAudioInputStreamTest, MirroringMultipleStreamsAndTargets) { |
| 474 RUN_ON_AUDIO_THREAD(Open); |
| 475 RUN_ON_AUDIO_THREAD(Start); |
| 476 RUN_ON_AUDIO_THREAD(AddAnotherInput); |
| 477 WaitForData(); |
| 478 RUN_ON_AUDIO_THREAD(AddAnotherInput); |
| 479 RUN_ON_AUDIO_THREAD(AddAnotherInput); |
| 480 RUN_ON_AUDIO_THREAD(AddAnotherInput); |
| 481 WaitForData(); |
| 482 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); |
| 483 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 484 WaitForData(); |
| 485 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 486 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 487 RUN_ON_AUDIO_THREAD(AddAnotherInput); |
| 488 WaitForData(); |
| 489 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 490 WaitForData(); |
| 491 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); |
| 492 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 493 RUN_ON_AUDIO_THREAD(Stop); |
| 494 RUN_ON_AUDIO_THREAD(Close); |
| 495 } |
| 496 |
| 497 } // namespace content |
OLD | NEW |