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

Side by Side Diff: media/audio/mac/audio_low_latency_input_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 (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 <memory> 7 #include <memory>
8 8
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 fs, 16, samples_per_packet), 151 fs, 16, samples_per_packet),
152 AudioDeviceDescription::kDefaultDeviceId, 152 AudioDeviceDescription::kDefaultDeviceId,
153 base::Bind(&MacAudioInputTest::OnLogMessage, base::Unretained(this))); 153 base::Bind(&MacAudioInputTest::OnLogMessage, base::Unretained(this)));
154 EXPECT_TRUE(ais); 154 EXPECT_TRUE(ais);
155 return ais; 155 return ais;
156 } 156 }
157 157
158 void OnLogMessage(const std::string& message) { log_message_ = message; } 158 void OnLogMessage(const std::string& message) { log_message_ = message; }
159 159
160 base::MessageLoop message_loop_; 160 base::MessageLoop message_loop_;
161 ScopedAudioManagerPtr audio_manager_; 161 std::unique_ptr<AudioManager> audio_manager_;
162 std::string log_message_; 162 std::string log_message_;
163 }; 163 };
164 164
165 // Test Create(), Close(). 165 // Test Create(), Close().
166 TEST_F(MacAudioInputTest, AUAudioInputStreamCreateAndClose) { 166 TEST_F(MacAudioInputTest, AUAudioInputStreamCreateAndClose) {
167 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable()); 167 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable());
168 AudioInputStream* ais = CreateDefaultAudioInputStream(); 168 AudioInputStream* ais = CreateDefaultAudioInputStream();
169 ais->Close(); 169 ais->Close();
170 } 170 }
171 171
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 WriteToFileAudioSink file_sink(file_name); 280 WriteToFileAudioSink file_sink(file_name);
281 fprintf(stderr, " >> Speak into the mic while recording...\n"); 281 fprintf(stderr, " >> Speak into the mic while recording...\n");
282 ais->Start(&file_sink); 282 ais->Start(&file_sink);
283 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); 283 base::PlatformThread::Sleep(TestTimeouts::action_timeout());
284 ais->Stop(); 284 ais->Stop();
285 fprintf(stderr, " >> Recording has stopped.\n"); 285 fprintf(stderr, " >> Recording has stopped.\n");
286 ais->Close(); 286 ais->Close();
287 } 287 }
288 288
289 } // namespace media 289 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698