| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 .Times(num_times_to_be_started); | 185 .Times(num_times_to_be_started); |
| 186 } | 186 } |
| 187 | 187 |
| 188 controller_->StartDiverting(&mock_stream_); | 188 controller_->StartDiverting(&mock_stream_); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void ReadDivertedAudioData() { | 191 void ReadDivertedAudioData() { |
| 192 scoped_ptr<AudioBus> dest = AudioBus::Create(params_); | 192 scoped_ptr<AudioBus> dest = AudioBus::Create(params_); |
| 193 ASSERT_TRUE(!!mock_stream_.callback()); | 193 ASSERT_TRUE(!!mock_stream_.callback()); |
| 194 const int frames_read = | 194 const int frames_read = |
| 195 mock_stream_.callback()->OnMoreData(dest.get(), 0); | 195 mock_stream_.callback()->OnMoreData(dest.get(), AudioBuffersState()); |
| 196 EXPECT_LT(0, frames_read); | 196 EXPECT_LT(0, frames_read); |
| 197 EXPECT_EQ(kBufferNonZeroData, dest->channel(0)[0]); | 197 EXPECT_EQ(kBufferNonZeroData, dest->channel(0)[0]); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void Revert(bool was_playing) { | 200 void Revert(bool was_playing) { |
| 201 if (was_playing) { | 201 if (was_playing) { |
| 202 // Expect the handler to receive one OnPlaying() call as a result of the | 202 // Expect the handler to receive one OnPlaying() call as a result of the |
| 203 // stream switching back. | 203 // stream switching back. |
| 204 EXPECT_CALL(mock_event_handler_, OnPlaying()) | 204 EXPECT_CALL(mock_event_handler_, OnPlaying()) |
| 205 .WillOnce(SignalEvent(&play_event_)); | 205 .WillOnce(SignalEvent(&play_event_)); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 | 405 |
| 406 TEST_F(AudioOutputControllerTest, DivertRevertClose) { | 406 TEST_F(AudioOutputControllerTest, DivertRevertClose) { |
| 407 Create(kSamplesPerPacket); | 407 Create(kSamplesPerPacket); |
| 408 WaitForCreate(); | 408 WaitForCreate(); |
| 409 DivertNeverPlaying(); | 409 DivertNeverPlaying(); |
| 410 RevertWasNotPlaying(); | 410 RevertWasNotPlaying(); |
| 411 Close(); | 411 Close(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace media | 414 } // namespace media |
| OLD | NEW |