OLD | NEW |
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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "media/audio/audio_io.h" | 10 #include "media/audio/audio_io.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 MOCK_METHOD3(OnMoreIOData, int(AudioBus* source, | 36 MOCK_METHOD3(OnMoreIOData, int(AudioBus* source, |
37 AudioBus* dest, | 37 AudioBus* dest, |
38 AudioBuffersState buffers_state)); | 38 AudioBuffersState buffers_state)); |
39 MOCK_METHOD1(OnError, void(AudioOutputStream* stream)); | 39 MOCK_METHOD1(OnError, void(AudioOutputStream* stream)); |
40 }; | 40 }; |
41 | 41 |
42 class AUHALStreamTest : public testing::Test { | 42 class AUHALStreamTest : public testing::Test { |
43 public: | 43 public: |
44 AUHALStreamTest() | 44 AUHALStreamTest() |
45 : message_loop_(base::MessageLoop::TYPE_UI), | 45 : message_loop_(base::MessageLoop::TYPE_UI), |
46 manager_(AudioManager::CreateForTesting()) {} | 46 manager_(AudioManager::CreateForTesting()) { |
| 47 // Wait for the AudioManager to finish any initialization on the audio loop. |
| 48 base::RunLoop().RunUntilIdle(); |
| 49 } |
47 | 50 |
48 virtual ~AUHALStreamTest() { | 51 virtual ~AUHALStreamTest() { |
49 base::RunLoop().RunUntilIdle(); | 52 base::RunLoop().RunUntilIdle(); |
50 } | 53 } |
51 | 54 |
52 AudioOutputStream* Create() { | 55 AudioOutputStream* Create() { |
53 return manager_->MakeAudioOutputStream( | 56 return manager_->MakeAudioOutputStream( |
54 manager_->GetDefaultOutputStreamParameters(), "", ""); | 57 manager_->GetDefaultOutputStreamParameters(), "", ""); |
55 } | 58 } |
56 | 59 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 .WillOnce(DoAll(ZeroBuffer(), SignalEvent(&event), Return(0))); | 106 .WillOnce(DoAll(ZeroBuffer(), SignalEvent(&event), Return(0))); |
104 EXPECT_CALL(source_, OnError(_)).Times(0); | 107 EXPECT_CALL(source_, OnError(_)).Times(0); |
105 stream->Start(&source_); | 108 stream->Start(&source_); |
106 event.Wait(); | 109 event.Wait(); |
107 | 110 |
108 stream->Stop(); | 111 stream->Stop(); |
109 stream->Close(); | 112 stream->Close(); |
110 } | 113 } |
111 | 114 |
112 } // namespace media | 115 } // namespace media |
OLD | NEW |