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

Side by Side Diff: media/audio/mac/audio_auhal_mac_unittest.cc

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: fixes content_browsertests and content_unittests 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "base/test/test_message_loop.h" 9 #include "base/test/test_message_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 bool OutputDevicesAvailable() { 54 bool OutputDevicesAvailable() {
55 return manager_->HasAudioOutputDevices(); 55 return manager_->HasAudioOutputDevices();
56 } 56 }
57 57
58 void OnLogMessage(const std::string& message) { log_message_ = message; } 58 void OnLogMessage(const std::string& message) { log_message_ = message; }
59 59
60 protected: 60 protected:
61 base::TestMessageLoop message_loop_; 61 base::TestMessageLoop message_loop_;
62 ScopedAudioManagerPtr manager_; 62 std::unique_ptr<AudioManager> manager_;
63 MockAudioSourceCallback source_; 63 MockAudioSourceCallback source_;
64 std::string log_message_; 64 std::string log_message_;
65 65
66 private: 66 private:
67 DISALLOW_COPY_AND_ASSIGN(AUHALStreamTest); 67 DISALLOW_COPY_AND_ASSIGN(AUHALStreamTest);
68 }; 68 };
69 69
70 TEST_F(AUHALStreamTest, HardwareSampleRate) { 70 TEST_F(AUHALStreamTest, HardwareSampleRate) {
71 ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable()); 71 ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable());
72 const AudioParameters preferred_params = 72 const AudioParameters preferred_params =
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 stream->Start(&source_); 108 stream->Start(&source_);
109 event.Wait(); 109 event.Wait();
110 110
111 stream->Stop(); 111 stream->Stop();
112 stream->Close(); 112 stream->Close();
113 113
114 EXPECT_FALSE(log_message_.empty()); 114 EXPECT_FALSE(log_message_.empty());
115 } 115 }
116 116
117 } // namespace media 117 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698