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/audio_mirroring_manager.h" | 5 #include "content/browser/renderer_host/media/audio_mirroring_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
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 28 matching lines...) Expand all Loading... |
39 public: | 39 public: |
40 MOCK_METHOD1(AddInput, | 40 MOCK_METHOD1(AddInput, |
41 media::AudioOutputStream*(const media::AudioParameters& params)); | 41 media::AudioOutputStream*(const media::AudioParameters& params)); |
42 }; | 42 }; |
43 | 43 |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 class AudioMirroringManagerTest : public testing::Test { | 46 class AudioMirroringManagerTest : public testing::Test { |
47 public: | 47 public: |
48 AudioMirroringManagerTest() | 48 AudioMirroringManagerTest() |
49 : message_loop_(base::MessageLoop::TYPE_IO), | 49 : io_thread_(BrowserThread::IO, &message_loop_), |
50 io_thread_(BrowserThread::IO, &message_loop_), | |
51 params_(AudioParameters::AUDIO_FAKE, media::CHANNEL_LAYOUT_STEREO, | 50 params_(AudioParameters::AUDIO_FAKE, media::CHANNEL_LAYOUT_STEREO, |
52 AudioParameters::kAudioCDSampleRate, 16, | 51 AudioParameters::kAudioCDSampleRate, 16, |
53 AudioParameters::kAudioCDSampleRate / 10) {} | 52 AudioParameters::kAudioCDSampleRate / 10) {} |
54 | 53 |
55 MockDiverter* CreateStream( | 54 MockDiverter* CreateStream( |
56 int render_process_id, int render_view_id, int expected_times_diverted) { | 55 int render_process_id, int render_view_id, int expected_times_diverted) { |
57 MockDiverter* const diverter = new MockDiverter(); | 56 MockDiverter* const diverter = new MockDiverter(); |
58 if (expected_times_diverted > 0) { | 57 if (expected_times_diverted > 0) { |
59 EXPECT_CALL(*diverter, GetAudioParameters()) | 58 EXPECT_CALL(*diverter, GetAudioParameters()) |
60 .Times(expected_times_diverted) | 59 .Times(expected_times_diverted) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 94 } |
96 | 95 |
97 void StopMirroringTo(int render_process_id, int render_view_id, | 96 void StopMirroringTo(int render_process_id, int render_view_id, |
98 MockMirroringDestination* dest) { | 97 MockMirroringDestination* dest) { |
99 mirroring_manager_.StopMirroring(render_process_id, render_view_id, dest); | 98 mirroring_manager_.StopMirroring(render_process_id, render_view_id, dest); |
100 | 99 |
101 delete dest; | 100 delete dest; |
102 } | 101 } |
103 | 102 |
104 private: | 103 private: |
105 base::MessageLoop message_loop_; | 104 base::MessageLoopForIO message_loop_; |
106 BrowserThreadImpl io_thread_; | 105 BrowserThreadImpl io_thread_; |
107 AudioParameters params_; | 106 AudioParameters params_; |
108 AudioMirroringManager mirroring_manager_; | 107 AudioMirroringManager mirroring_manager_; |
109 | 108 |
110 DISALLOW_COPY_AND_ASSIGN(AudioMirroringManagerTest); | 109 DISALLOW_COPY_AND_ASSIGN(AudioMirroringManagerTest); |
111 }; | 110 }; |
112 | 111 |
113 namespace { | 112 namespace { |
114 const int kRenderProcessId = 123; | 113 const int kRenderProcessId = 123; |
115 const int kRenderViewId = 456; | 114 const int kRenderViewId = 456; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 yet_another_destination); | 224 yet_another_destination); |
226 | 225 |
227 StopMirroringTo(kRenderProcessId, kRenderViewId, destination); | 226 StopMirroringTo(kRenderProcessId, kRenderViewId, destination); |
228 | 227 |
229 KillStream(kAnotherRenderProcessId, kAnotherRenderViewId, another_stream); | 228 KillStream(kAnotherRenderProcessId, kAnotherRenderViewId, another_stream); |
230 KillStream(kYetAnotherRenderProcessId, kYetAnotherRenderViewId, | 229 KillStream(kYetAnotherRenderProcessId, kYetAnotherRenderViewId, |
231 yet_another_stream); | 230 yet_another_stream); |
232 } | 231 } |
233 | 232 |
234 } // namespace content | 233 } // namespace content |
OLD | NEW |