| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/environment.h" | 7 #include "base/environment.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "media/audio/audio_manager_base.h" | 13 #include "media/audio/audio_manager_base.h" |
| 14 #include "media/audio/audio_output_controller.h" | 14 #include "media/audio/audio_output_controller.h" |
| 15 #include "media/audio/audio_parameters.h" | 15 #include "media/audio/audio_parameters.h" |
| 16 #include "media/base/audio_bus.h" | 16 #include "media/base/audio_bus.h" |
| 17 #include "media/base/fake_media_resources.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 20 |
| 20 using ::testing::_; | 21 using ::testing::_; |
| 21 using ::testing::AtLeast; | 22 using ::testing::AtLeast; |
| 22 using ::testing::DoAll; | 23 using ::testing::DoAll; |
| 23 using ::testing::Invoke; | 24 using ::testing::Invoke; |
| 24 using ::testing::NotNull; | 25 using ::testing::NotNull; |
| 25 using ::testing::Return; | 26 using ::testing::Return; |
| 26 | 27 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 211 |
| 211 void SwitchDevice(bool diverting) { | 212 void SwitchDevice(bool diverting) { |
| 212 if (!diverting) { | 213 if (!diverting) { |
| 213 // Expect the current stream to close and a new stream to start | 214 // Expect the current stream to close and a new stream to start |
| 214 // playing if not diverting. When diverting, nothing happens | 215 // playing if not diverting. When diverting, nothing happens |
| 215 // until diverting is stopped. | 216 // until diverting is stopped. |
| 216 EXPECT_CALL(mock_event_handler_, OnPlaying()) | 217 EXPECT_CALL(mock_event_handler_, OnPlaying()) |
| 217 .WillOnce(SignalEvent(&play_event_)); | 218 .WillOnce(SignalEvent(&play_event_)); |
| 218 } | 219 } |
| 219 | 220 |
| 220 controller_->SwitchOutputDevice(AudioManagerBase::kDefaultDeviceName, | 221 controller_->SwitchOutputDevice(AudioManager::GetDefaultDeviceName(), |
| 221 base::Bind(&base::DoNothing)); | 222 base::Bind(&base::DoNothing)); |
| 222 } | 223 } |
| 223 | 224 |
| 224 void Close() { | 225 void Close() { |
| 225 EXPECT_CALL(mock_sync_reader_, Close()); | 226 EXPECT_CALL(mock_sync_reader_, Close()); |
| 226 | 227 |
| 227 controller_->Close(base::MessageLoop::QuitClosure()); | 228 controller_->Close(base::MessageLoop::QuitClosure()); |
| 228 base::MessageLoop::current()->Run(); | 229 base::MessageLoop::current()->Run(); |
| 229 } | 230 } |
| 230 | 231 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 404 |
| 404 TEST_F(AudioOutputControllerTest, DivertRevertClose) { | 405 TEST_F(AudioOutputControllerTest, DivertRevertClose) { |
| 405 Create(kSamplesPerPacket); | 406 Create(kSamplesPerPacket); |
| 406 WaitForCreate(); | 407 WaitForCreate(); |
| 407 DivertNeverPlaying(); | 408 DivertNeverPlaying(); |
| 408 RevertWasNotPlaying(); | 409 RevertWasNotPlaying(); |
| 409 Close(); | 410 Close(); |
| 410 } | 411 } |
| 411 | 412 |
| 412 } // namespace media | 413 } // namespace media |
| OLD | NEW |