| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 "content/browser/renderer_host/media/web_contents_audio_input_stream.h" | 5 #include "content/browser/renderer_host/media/web_contents_audio_input_stream.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { | 159 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { |
| 160 public: | 160 public: |
| 161 MockAudioInputCallback() {} | 161 MockAudioInputCallback() {} |
| 162 | 162 |
| 163 MOCK_METHOD5(OnData, void(AudioInputStream* stream, const uint8* src, | 163 MOCK_METHOD5(OnData, void(AudioInputStream* stream, const uint8* src, |
| 164 uint32 size, uint32 hardware_delay_bytes, | 164 uint32 size, uint32 hardware_delay_bytes, |
| 165 double volume)); | 165 double volume)); |
| 166 MOCK_METHOD1(OnClose, void(AudioInputStream* stream)); | 166 MOCK_METHOD1(OnClose, void(AudioInputStream* stream)); |
| 167 MOCK_METHOD2(OnError, void(AudioInputStream* stream, int code)); | 167 MOCK_METHOD1(OnError, void(AudioInputStream* stream)); |
| 168 | 168 |
| 169 private: | 169 private: |
| 170 DISALLOW_COPY_AND_ASSIGN(MockAudioInputCallback); | 170 DISALLOW_COPY_AND_ASSIGN(MockAudioInputCallback); |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 } // namespace | 173 } // namespace |
| 174 | 174 |
| 175 class WebContentsAudioInputStreamTest : public testing::Test { | 175 class WebContentsAudioInputStreamTest : public testing::Test { |
| 176 public: | 176 public: |
| 177 WebContentsAudioInputStreamTest() | 177 WebContentsAudioInputStreamTest() |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 328 |
| 329 // Simulate OnTargetChange() callback from WebContentsTracker. | 329 // Simulate OnTargetChange() callback from WebContentsTracker. |
| 330 EXPECT_FALSE(change_callback_.is_null()); | 330 EXPECT_FALSE(change_callback_.is_null()); |
| 331 change_callback_.Run(next_render_process_id, next_render_view_id); | 331 change_callback_.Run(next_render_process_id, next_render_view_id); |
| 332 | 332 |
| 333 current_render_process_id_ = next_render_process_id; | 333 current_render_process_id_ = next_render_process_id; |
| 334 current_render_view_id_ = next_render_view_id; | 334 current_render_view_id_ = next_render_view_id; |
| 335 } | 335 } |
| 336 | 336 |
| 337 void LoseMirroringTarget() { | 337 void LoseMirroringTarget() { |
| 338 EXPECT_CALL(mock_input_callback_, OnError(_, _)); | 338 EXPECT_CALL(mock_input_callback_, OnError(_)); |
| 339 | 339 |
| 340 // Simulate OnTargetChange() callback from WebContentsTracker. | 340 // Simulate OnTargetChange() callback from WebContentsTracker. |
| 341 EXPECT_FALSE(change_callback_.is_null()); | 341 EXPECT_FALSE(change_callback_.is_null()); |
| 342 change_callback_.Run(-1, -1); | 342 change_callback_.Run(-1, -1); |
| 343 } | 343 } |
| 344 | 344 |
| 345 void Stop() { | 345 void Stop() { |
| 346 wcais_->Stop(); | 346 wcais_->Stop(); |
| 347 } | 347 } |
| 348 | 348 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 WaitForData(); | 504 WaitForData(); |
| 505 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); | 505 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 506 WaitForData(); | 506 WaitForData(); |
| 507 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); | 507 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); |
| 508 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); | 508 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
| 509 RUN_ON_AUDIO_THREAD(Stop); | 509 RUN_ON_AUDIO_THREAD(Stop); |
| 510 RUN_ON_AUDIO_THREAD(Close); | 510 RUN_ON_AUDIO_THREAD(Close); |
| 511 } | 511 } |
| 512 | 512 |
| 513 } // namespace content | 513 } // namespace content |
| OLD | NEW |