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

Side by Side Diff: media/audio/win/audio_low_latency_input_win_unittest.cc

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: chromeos and android build Created 3 years, 8 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
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 "media/audio/win/audio_low_latency_input_win.h" 5 #include "media/audio/win/audio_low_latency_input_win.h"
6 6
7 #include <mmsystem.h> 7 #include <mmsystem.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <windows.h> 10 #include <windows.h>
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 AudioManager::CreateForTesting(message_loop_.task_runner()); 262 AudioManager::CreateForTesting(message_loop_.task_runner());
263 base::RunLoop().RunUntilIdle(); 263 base::RunLoop().RunUntilIdle();
264 } 264 }
265 ~WinAudioInputTest() override { 265 ~WinAudioInputTest() override {
266 audio_manager_.reset(); 266 audio_manager_.reset();
267 base::RunLoop().RunUntilIdle(); 267 base::RunLoop().RunUntilIdle();
268 } 268 }
269 269
270 protected: 270 protected:
271 base::MessageLoop message_loop_; 271 base::MessageLoop message_loop_;
272 ScopedAudioManagerPtr audio_manager_; 272 std::unique_ptr<AudioManager> audio_manager_;
273 }; 273 };
274 274
275 // Verify that we can retrieve the current hardware/mixing sample rate 275 // Verify that we can retrieve the current hardware/mixing sample rate
276 // for all available input devices. 276 // for all available input devices.
277 TEST_F(WinAudioInputTest, WASAPIAudioInputStreamHardwareSampleRate) { 277 TEST_F(WinAudioInputTest, WASAPIAudioInputStreamHardwareSampleRate) {
278 ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndInputDevices(audio_manager_.get())); 278 ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndInputDevices(audio_manager_.get()));
279 279
280 // Retrieve a list of all available input devices. 280 // Retrieve a list of all available input devices.
281 media::AudioDeviceDescriptions device_descriptions; 281 media::AudioDeviceDescriptions device_descriptions;
282 audio_manager_->GetAudioInputDeviceDescriptions(&device_descriptions); 282 audio_manager_->GetAudioInputDeviceDescriptions(&device_descriptions);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 ais->Start(&file_sink); 551 ais->Start(&file_sink);
552 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); 552 base::PlatformThread::Sleep(TestTimeouts::action_timeout());
553 // base::PlatformThread::Sleep(base::TimeDelta::FromMinutes(10)); 553 // base::PlatformThread::Sleep(base::TimeDelta::FromMinutes(10));
554 ais->Stop(); 554 ais->Stop();
555 VLOG(0) << ">> Recording has stopped."; 555 VLOG(0) << ">> Recording has stopped.";
556 ais.Close(); 556 ais.Close();
557 } 557 }
558 } 558 }
559 559
560 } // namespace media 560 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698