Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager_unittest.cc

Issue 1483533003: Fix teardown of a couple of test suites Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New runloop Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/media/video_capture_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 MediaStreamManagerTest() 163 MediaStreamManagerTest()
164 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), 164 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
165 task_runner_(base::ThreadTaskRunnerHandle::Get()) { 165 task_runner_(base::ThreadTaskRunnerHandle::Get()) {
166 // Create our own MediaStreamManager. Use fake devices to run on the bots. 166 // Create our own MediaStreamManager. Use fake devices to run on the bots.
167 base::CommandLine::ForCurrentProcess()->AppendSwitch( 167 base::CommandLine::ForCurrentProcess()->AppendSwitch(
168 switches::kUseFakeDeviceForMediaStream); 168 switches::kUseFakeDeviceForMediaStream);
169 audio_manager_.reset(new MockAudioManager()); 169 audio_manager_.reset(new MockAudioManager());
170 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); 170 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get()));
171 } 171 }
172 172
173 virtual ~MediaStreamManagerTest() { 173 ~MediaStreamManagerTest() override {
174 // Since the main thread of this test suite is the IO thread,
175 // we need to flush it to clear any pending operations before
176 // deleting the MSM.
177 base::RunLoop loop;
178 loop.RunUntilIdle();
179 media_stream_manager_->WillDestroyCurrentMessageLoop();
174 } 180 }
175 181
176 MOCK_METHOD1(Response, void(int index)); 182 MOCK_METHOD1(Response, void(int index));
177 void ResponseCallback(int index, 183 void ResponseCallback(int index,
178 const MediaStreamDevices& devices, 184 const MediaStreamDevices& devices,
179 scoped_ptr<MediaStreamUIProxy> ui_proxy) { 185 scoped_ptr<MediaStreamUIProxy> ui_proxy) {
180 Response(index); 186 Response(index);
181 task_runner_->PostTask(FROM_HERE, run_loop_.QuitClosure()); 187 task_runner_->PostTask(FROM_HERE, run_loop_.QuitClosure());
182 } 188 }
183 189
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 std::string label = media_stream_manager_->EnumerateDevices( 321 std::string label = media_stream_manager_->EnumerateDevices(
316 &requester, render_process_id, render_frame_id, GetMockSaltCallback(), 322 &requester, render_process_id, render_frame_id, GetMockSaltCallback(),
317 page_request_id, MEDIA_DEVICE_AUDIO_OUTPUT, security_origin); 323 page_request_id, MEDIA_DEVICE_AUDIO_OUTPUT, security_origin);
318 run_loop.Run(); 324 run_loop.Run();
319 // CancelRequest is necessary for enumeration requests. 325 // CancelRequest is necessary for enumeration requests.
320 media_stream_manager_->CancelRequest(label); 326 media_stream_manager_->CancelRequest(label);
321 } 327 }
322 } 328 }
323 329
324 } // namespace content 330 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/video_capture_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698