| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
| 10 #include "media/audio/audio_output_dispatcher_impl.h" | 10 #include "media/audio/audio_output_dispatcher_impl.h" |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 .Times(1); | 458 .Times(1); |
| 459 EXPECT_CALL(stream, Close()) | 459 EXPECT_CALL(stream, Close()) |
| 460 .Times(1); | 460 .Times(1); |
| 461 | 461 |
| 462 AudioOutputProxy* proxy1 = new AudioOutputProxy(mixer_); | 462 AudioOutputProxy* proxy1 = new AudioOutputProxy(mixer_); |
| 463 AudioOutputProxy* proxy2 = new AudioOutputProxy(mixer_); | 463 AudioOutputProxy* proxy2 = new AudioOutputProxy(mixer_); |
| 464 EXPECT_TRUE(proxy1->Open()); | 464 EXPECT_TRUE(proxy1->Open()); |
| 465 EXPECT_TRUE(proxy2->Open()); | 465 EXPECT_TRUE(proxy2->Open()); |
| 466 | 466 |
| 467 proxy1->Start(&callback_); | 467 proxy1->Start(&callback_); |
| 468 |
| 469 // Mute the proxy. Resulting stream should still have correct length. |
| 470 proxy1->SetVolume(0.0); |
| 471 |
| 468 uint8 zeroes[4] = {0, 0, 0, 0}; | 472 uint8 zeroes[4] = {0, 0, 0, 0}; |
| 469 uint8 buf1[4] = {0}; | 473 uint8 buf1[4] = {0}; |
| 470 EXPECT_CALL(callback_, | 474 EXPECT_CALL(callback_, |
| 471 OnMoreData(NotNull(), 4, | 475 OnMoreData(NotNull(), 4, |
| 472 AllOf(Field(&AudioBuffersState::pending_bytes, 0), | 476 AllOf(Field(&AudioBuffersState::pending_bytes, 0), |
| 473 Field(&AudioBuffersState::hardware_delay_bytes, 0)))) | 477 Field(&AudioBuffersState::hardware_delay_bytes, 0)))) |
| 474 .WillOnce(DoAll(SetArrayArgument<0>(zeroes, zeroes + sizeof(zeroes)), | 478 .WillOnce(DoAll(SetArrayArgument<0>(zeroes, zeroes + sizeof(zeroes)), |
| 475 Return(4))); | 479 Return(4))); |
| 476 mixer_->OnMoreData(buf1, sizeof(buf1), AudioBuffersState(0, 0)); | 480 mixer_->OnMoreData(buf1, sizeof(buf1), AudioBuffersState(0, 0)); |
| 477 proxy2->Start(&callback_); | 481 proxy2->Start(&callback_); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 | 583 |
| 580 proxy2->Start(&callback_); | 584 proxy2->Start(&callback_); |
| 581 | 585 |
| 582 Mock::VerifyAndClear(&callback_); | 586 Mock::VerifyAndClear(&callback_); |
| 583 | 587 |
| 584 proxy2->Close(); | 588 proxy2->Close(); |
| 585 WaitForCloseTimer(kTestCloseDelayMs); | 589 WaitForCloseTimer(kTestCloseDelayMs); |
| 586 } | 590 } |
| 587 | 591 |
| 588 } // namespace media | 592 } // namespace media |
| OLD | NEW |