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/media/capture/web_contents_audio_input_stream.h" | 5 #include "content/browser/media/capture/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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // Note: Arbitrarily chosen, but more iterations causes tests to take | 349 // Note: Arbitrarily chosen, but more iterations causes tests to take |
350 // significantly more time. | 350 // significantly more time. |
351 static const int kNumIterations = 3; | 351 static const int kNumIterations = 3; |
352 for (int i = 0; i < kNumIterations; ++i) | 352 for (int i = 0; i < kNumIterations; ++i) |
353 on_data_event_.Wait(); | 353 on_data_event_.Wait(); |
354 } | 354 } |
355 | 355 |
356 private: | 356 private: |
357 void SimulateChangeCallback(int render_process_id, int render_frame_id) { | 357 void SimulateChangeCallback(int render_process_id, int render_frame_id) { |
358 ASSERT_FALSE(change_callback_.is_null()); | 358 ASSERT_FALSE(change_callback_.is_null()); |
359 if (render_process_id == -1 || render_frame_id == -1) { | 359 change_callback_.Run(render_process_id != -1 && render_frame_id != -1); |
360 change_callback_.Run(NULL); | |
361 } else { | |
362 // For our tests, any non-NULL value will suffice since it will not be | |
363 // dereferenced. | |
364 change_callback_.Run(reinterpret_cast<RenderWidgetHost*>(0xdeadbee5)); | |
365 } | |
366 } | 360 } |
367 | 361 |
368 scoped_ptr<TestBrowserThreadBundle> thread_bundle_; | 362 scoped_ptr<TestBrowserThreadBundle> thread_bundle_; |
369 base::Thread audio_thread_; | 363 base::Thread audio_thread_; |
370 | 364 |
371 scoped_ptr<MockAudioMirroringManager> mock_mirroring_manager_; | 365 scoped_ptr<MockAudioMirroringManager> mock_mirroring_manager_; |
372 scoped_refptr<MockWebContentsTracker> mock_tracker_; | 366 scoped_refptr<MockWebContentsTracker> mock_tracker_; |
373 | 367 |
374 MockVirtualAudioInputStream* mock_vais_; // Owned by wcais_. | 368 MockVirtualAudioInputStream* mock_vais_; // Owned by wcais_. |
375 WebContentsAudioInputStream* wcais_; // Self-destructs on Close(). | 369 WebContentsAudioInputStream* wcais_; // Self-destructs on Close(). |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 WaitForData(); | 494 WaitForData(); |
501 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); | 495 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
502 WaitForData(); | 496 WaitForData(); |
503 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); | 497 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); |
504 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); | 498 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
505 RUN_ON_AUDIO_THREAD(Stop); | 499 RUN_ON_AUDIO_THREAD(Stop); |
506 RUN_ON_AUDIO_THREAD(Close); | 500 RUN_ON_AUDIO_THREAD(Close); |
507 } | 501 } |
508 | 502 |
509 } // namespace content | 503 } // namespace content |
OLD | NEW |