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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
10 #include "content/browser/renderer_host/media/audio_input_device_manager.h" | 10 #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 content_client_->set_browser_for_testing(host_); | 193 content_client_->set_browser_for_testing(host_); |
194 } | 194 } |
195 | 195 |
196 virtual void TearDown() OVERRIDE { | 196 virtual void TearDown() OVERRIDE { |
197 message_loop_->RunAllPending(); | 197 message_loop_->RunAllPending(); |
198 | 198 |
199 // Recover the old browser client and content client. | 199 // Recover the old browser client and content client. |
200 content::GetContentClient()->set_browser_for_testing(old_browser_client_); | 200 content::GetContentClient()->set_browser_for_testing(old_browser_client_); |
201 content::SetContentClient(old_client_); | 201 content::SetContentClient(old_client_); |
202 content_client_.reset(); | 202 content_client_.reset(); |
| 203 |
| 204 // Delete the IO message loop to delete the device thread, |
| 205 // AudioInputDeviceManager and VideoCaptureManager. |
| 206 message_loop_.reset(); |
203 } | 207 } |
204 | 208 |
205 scoped_refptr<MockMediaStreamDispatcherHost> host_; | 209 scoped_refptr<MockMediaStreamDispatcherHost> host_; |
206 scoped_ptr<MessageLoop> message_loop_; | 210 scoped_ptr<MessageLoop> message_loop_; |
207 scoped_ptr<BrowserThreadImpl> io_thread_; | 211 scoped_ptr<BrowserThreadImpl> io_thread_; |
208 scoped_ptr<media::AudioManager> audio_manager_; | 212 scoped_ptr<media::AudioManager> audio_manager_; |
209 scoped_ptr<MediaStreamManager> media_stream_manager_; | 213 scoped_ptr<MediaStreamManager> media_stream_manager_; |
210 content::ContentClient* old_client_; | 214 content::ContentClient* old_client_; |
211 content::ContentBrowserClient* old_browser_client_; | 215 content::ContentBrowserClient* old_browser_client_; |
212 scoped_ptr<content::ContentClient> content_client_; | 216 scoped_ptr<content::ContentClient> content_client_; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 EXPECT_EQ(host_->video_devices_.size(), 0u); | 335 EXPECT_EQ(host_->video_devices_.size(), 0u); |
332 EXPECT_EQ(host_->NumberOfStreams(), 1u); | 336 EXPECT_EQ(host_->NumberOfStreams(), 1u); |
333 | 337 |
334 // TODO(perkj): test audio device failure? | 338 // TODO(perkj): test audio device failure? |
335 | 339 |
336 host_->OnStopGeneratedStream(label); | 340 host_->OnStopGeneratedStream(label); |
337 EXPECT_EQ(host_->NumberOfStreams(), 0u); | 341 EXPECT_EQ(host_->NumberOfStreams(), 0u); |
338 } | 342 } |
339 | 343 |
340 }; // namespace media_stream | 344 }; // namespace media_stream |
OLD | NEW |