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

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

Issue 233823003: Defer input stream start around suspend and resume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/audio/mac/audio_auhal_mac.cc » ('j') | 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/environment.h" 6 #include "base/environment.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h"
9 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/platform_thread.h" 11 #include "base/threading/platform_thread.h"
11 #include "media/audio/audio_io.h" 12 #include "media/audio/audio_io.h"
12 #include "media/audio/audio_manager_base.h" 13 #include "media/audio/audio_manager_base.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace media { 16 namespace media {
16 17
17 // This class allows to find out if the callbacks are occurring as 18 // This class allows to find out if the callbacks are occurring as
18 // expected and if any error has been reported. 19 // expected and if any error has been reported.
(...skipping 26 matching lines...) Expand all
45 int callback_count_; 46 int callback_count_;
46 int had_error_; 47 int had_error_;
47 }; 48 };
48 49
49 class AudioInputTest : public testing::Test { 50 class AudioInputTest : public testing::Test {
50 public: 51 public:
51 AudioInputTest() : 52 AudioInputTest() :
52 message_loop_(base::MessageLoop::TYPE_UI), 53 message_loop_(base::MessageLoop::TYPE_UI),
53 audio_manager_(AudioManager::CreateForTesting()), 54 audio_manager_(AudioManager::CreateForTesting()),
54 audio_input_stream_(NULL) { 55 audio_input_stream_(NULL) {
56 // Wait for the AudioManager to finish any initialization on the audio loop.
57 base::RunLoop().RunUntilIdle();
55 } 58 }
56 59
57 virtual ~AudioInputTest() {} 60 virtual ~AudioInputTest() {
61 base::RunLoop().RunUntilIdle();
62 }
58 63
59 protected: 64 protected:
60 AudioManager* audio_manager() { return audio_manager_.get(); } 65 AudioManager* audio_manager() { return audio_manager_.get(); }
61 66
62 bool CanRunAudioTests() { 67 bool CanRunAudioTests() {
63 bool has_input = audio_manager()->HasAudioInputDevices(); 68 bool has_input = audio_manager()->HasAudioInputDevices();
64 LOG_IF(WARNING, !has_input) << "No input devices detected"; 69 LOG_IF(WARNING, !has_input) << "No input devices detected";
65 return has_input; 70 return has_input;
66 } 71 }
67 72
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 base::MessageLoop::QuitClosure(), 235 base::MessageLoop::QuitClosure(),
231 base::TimeDelta::FromMilliseconds(500)); 236 base::TimeDelta::FromMilliseconds(500));
232 message_loop_.Run(); 237 message_loop_.Run();
233 EXPECT_GE(test_callback.callback_count(), 2); 238 EXPECT_GE(test_callback.callback_count(), 2);
234 EXPECT_FALSE(test_callback.had_error()); 239 EXPECT_FALSE(test_callback.had_error());
235 240
236 StopAndCloseAudioInputStreamOnAudioThread(); 241 StopAndCloseAudioInputStreamOnAudioThread();
237 } 242 }
238 243
239 } // namespace media 244 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/audio/mac/audio_auhal_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698