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

Side by Side Diff: media/audio/audio_output_device_unittest.cc

Issue 2828233002: DCHECK that audio devices are stopped prior to destruction. (Closed)
Patch Set: More DCHECKs! Created 3 years, 7 months 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 | « media/audio/audio_output_device.cc ('k') | no next file » | 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 default_audio_parameters_.Reset(AudioParameters::AUDIO_PCM_LINEAR, 151 default_audio_parameters_.Reset(AudioParameters::AUDIO_PCM_LINEAR,
152 CHANNEL_LAYOUT_STEREO, 48000, 16, 1024); 152 CHANNEL_LAYOUT_STEREO, 48000, 16, 1024);
153 SetDevice(kDefaultDeviceId); 153 SetDevice(kDefaultDeviceId);
154 } 154 }
155 155
156 AudioOutputDeviceTest::~AudioOutputDeviceTest() { 156 AudioOutputDeviceTest::~AudioOutputDeviceTest() {
157 audio_device_ = NULL; 157 audio_device_ = NULL;
158 } 158 }
159 159
160 void AudioOutputDeviceTest::CreateDevice(const std::string& device_id) { 160 void AudioOutputDeviceTest::CreateDevice(const std::string& device_id) {
161 // Make sure the previous device is properly cleaned up.
162 if (audio_device_)
163 StopAudioDevice();
164
161 audio_output_ipc_ = new MockAudioOutputIPC(); 165 audio_output_ipc_ = new MockAudioOutputIPC();
162 audio_device_ = new AudioOutputDevice( 166 audio_device_ = new AudioOutputDevice(
163 base::WrapUnique(audio_output_ipc_), io_loop_.task_runner(), 0, device_id, 167 base::WrapUnique(audio_output_ipc_), io_loop_.task_runner(), 0, device_id,
164 url::Origin(), 168 url::Origin(),
165 base::TimeDelta::FromMilliseconds(kAuthTimeoutForTestingMs)); 169 base::TimeDelta::FromMilliseconds(kAuthTimeoutForTestingMs));
166 } 170 }
167 171
168 void AudioOutputDeviceTest::SetDevice(const std::string& device_id) { 172 void AudioOutputDeviceTest::SetDevice(const std::string& device_id) {
169 CreateDevice(device_id); 173 CreateDevice(device_id);
170 EXPECT_CALL(*audio_output_ipc_, 174 EXPECT_CALL(*audio_output_ipc_,
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // Runs the loop and waits for |thread| to call event's closure. 378 // Runs the loop and waits for |thread| to call event's closure.
375 event.RunAndWait(); 379 event.RunAndWait();
376 380
377 audio_device_->Stop(); 381 audio_device_->Stop();
378 base::RunLoop().RunUntilIdle(); 382 base::RunLoop().RunUntilIdle();
379 } 383 }
380 384
381 INSTANTIATE_TEST_CASE_P(Render, AudioOutputDeviceTest, Values(false)); 385 INSTANTIATE_TEST_CASE_P(Render, AudioOutputDeviceTest, Values(false));
382 386
383 } // namespace media. 387 } // namespace media.
OLDNEW
« no previous file with comments | « media/audio/audio_output_device.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698