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

Side by Side Diff: media/audio/win/audio_low_latency_output_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, 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
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_output_win.h" 5 #include "media/audio/win/audio_low_latency_output_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <mmsystem.h> 8 #include <mmsystem.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 AudioManager::CreateForTesting(message_loop_.task_runner()); 238 AudioManager::CreateForTesting(message_loop_.task_runner());
239 base::RunLoop().RunUntilIdle(); 239 base::RunLoop().RunUntilIdle();
240 } 240 }
241 ~WASAPIAudioOutputStreamTest() override { 241 ~WASAPIAudioOutputStreamTest() override {
242 audio_manager_.reset(); 242 audio_manager_.reset();
243 base::RunLoop().RunUntilIdle(); 243 base::RunLoop().RunUntilIdle();
244 } 244 }
245 245
246 protected: 246 protected:
247 base::MessageLoopForUI message_loop_; 247 base::MessageLoopForUI message_loop_;
248 ScopedAudioManagerPtr audio_manager_; 248 std::unique_ptr<AudioManager> audio_manager_;
249 }; 249 };
250 250
251 // Test Create(), Close() calling sequence. 251 // Test Create(), Close() calling sequence.
252 TEST_F(WASAPIAudioOutputStreamTest, CreateAndClose) { 252 TEST_F(WASAPIAudioOutputStreamTest, CreateAndClose) {
253 ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager_.get())); 253 ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager_.get()));
254 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager_.get()); 254 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager_.get());
255 aos->Close(); 255 aos->Close();
256 } 256 }
257 257
258 // Test Open(), Close() calling sequence. 258 // Test Open(), Close() calling sequence.
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 aos->Start(&source); 612 aos->Start(&source);
613 message_loop_.task_runner()->PostDelayedTask( 613 message_loop_.task_runner()->PostDelayedTask(
614 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 614 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
615 TestTimeouts::action_timeout()); 615 TestTimeouts::action_timeout());
616 base::RunLoop().Run(); 616 base::RunLoop().Run();
617 aos->Stop(); 617 aos->Stop();
618 aos->Close(); 618 aos->Close();
619 } 619 }
620 620
621 } // namespace media 621 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698