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" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 void ChangeDevice() { | 159 void ChangeDevice() { |
160 // Expect the event handler to receive one OnPaying() call and no OnPaused() | 160 // Expect the event handler to receive one OnPaying() call and no OnPaused() |
161 // call. | 161 // call. |
162 EXPECT_CALL(mock_event_handler_, OnPlaying()) | 162 EXPECT_CALL(mock_event_handler_, OnPlaying()) |
163 .WillOnce(SignalEvent(&play_event_)); | 163 .WillOnce(SignalEvent(&play_event_)); |
164 EXPECT_CALL(mock_event_handler_, OnPaused()) | 164 EXPECT_CALL(mock_event_handler_, OnPaused()) |
165 .Times(0); | 165 .Times(0); |
166 | 166 |
167 // Simulate a device change event to AudioOutputController from the | 167 // Simulate a device change event to AudioOutputController from the |
168 // AudioManager. | 168 // AudioManager. |
169 audio_manager_->GetMessageLoop()->PostTask( | 169 audio_manager_->GetTaskRunner()->PostTask( |
170 FROM_HERE, | 170 FROM_HERE, |
171 base::Bind(&AudioOutputController::OnDeviceChange, controller_)); | 171 base::Bind(&AudioOutputController::OnDeviceChange, controller_)); |
172 } | 172 } |
173 | 173 |
174 void Divert(bool was_playing, int num_times_to_be_started) { | 174 void Divert(bool was_playing, int num_times_to_be_started) { |
175 if (was_playing) { | 175 if (was_playing) { |
176 // Expect the handler to receive one OnPlaying() call as a result of the | 176 // Expect the handler to receive one OnPlaying() call as a result of the |
177 // stream switching. | 177 // stream switching. |
178 EXPECT_CALL(mock_event_handler_, OnPlaying()) | 178 EXPECT_CALL(mock_event_handler_, OnPlaying()) |
179 .WillOnce(SignalEvent(&play_event_)); | 179 .WillOnce(SignalEvent(&play_event_)); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 | 411 |
412 TEST_F(AudioOutputControllerTest, DivertRevertClose) { | 412 TEST_F(AudioOutputControllerTest, DivertRevertClose) { |
413 Create(kSamplesPerPacket); | 413 Create(kSamplesPerPacket); |
414 WaitForCreate(); | 414 WaitForCreate(); |
415 DivertNeverPlaying(); | 415 DivertNeverPlaying(); |
416 RevertWasNotPlaying(); | 416 RevertWasNotPlaying(); |
417 Close(); | 417 Close(); |
418 } | 418 } |
419 | 419 |
420 } // namespace media | 420 } // namespace media |
OLD | NEW |