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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « media/audio/audio_input_controller_unittest.cc ('k') | media/audio/linux/alsa_output.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/bind.h" 5 #include "base/bind.h"
6 #include "base/environment.h" 6 #include "base/environment.h"
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 EXPECT_CALL(sync_reader, Close()); 101 EXPECT_CALL(sync_reader, Close());
102 102
103 AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout, 103 AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
104 kSampleRate, kBitsPerSample, kSamplesPerPacket); 104 kSampleRate, kBitsPerSample, kSamplesPerPacket);
105 scoped_refptr<AudioOutputController> controller = 105 scoped_refptr<AudioOutputController> controller =
106 AudioOutputController::Create( 106 AudioOutputController::Create(
107 audio_manager.get(), &event_handler, params, &sync_reader); 107 audio_manager.get(), &event_handler, params, &sync_reader);
108 ASSERT_TRUE(controller.get()); 108 ASSERT_TRUE(controller.get());
109 109
110 // Close the controller immediately. 110 // Close the controller immediately.
111 CloseAudioController(controller); 111 CloseAudioController(controller.get());
112 } 112 }
113 113
114 TEST_F(AudioOutputControllerTest, PlayPauseClose) { 114 TEST_F(AudioOutputControllerTest, PlayPauseClose) {
115 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); 115 scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
116 if (!audio_manager->HasAudioOutputDevices()) 116 if (!audio_manager->HasAudioOutputDevices())
117 return; 117 return;
118 118
119 MockAudioOutputControllerEventHandler event_handler; 119 MockAudioOutputControllerEventHandler event_handler;
120 base::WaitableEvent event(false, false); 120 base::WaitableEvent event(false, false);
121 base::WaitableEvent pause_event(false, false); 121 base::WaitableEvent pause_event(false, false);
(...skipping 26 matching lines...) Expand all
148 148
149 // Wait for OnCreated() to be called. 149 // Wait for OnCreated() to be called.
150 event.Wait(); 150 event.Wait();
151 151
152 ASSERT_FALSE(pause_event.IsSignaled()); 152 ASSERT_FALSE(pause_event.IsSignaled());
153 controller->Play(); 153 controller->Play();
154 controller->Pause(); 154 controller->Pause();
155 pause_event.Wait(); 155 pause_event.Wait();
156 156
157 // Now stop the controller. 157 // Now stop the controller.
158 CloseAudioController(controller); 158 CloseAudioController(controller.get());
159 } 159 }
160 160
161 TEST_F(AudioOutputControllerTest, HardwareBufferTooLarge) { 161 TEST_F(AudioOutputControllerTest, HardwareBufferTooLarge) {
162 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); 162 scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
163 if (!audio_manager->HasAudioOutputDevices()) 163 if (!audio_manager->HasAudioOutputDevices())
164 return; 164 return;
165 165
166 // Create an audio device with a very large hardware buffer size. 166 // Create an audio device with a very large hardware buffer size.
167 MockAudioOutputControllerEventHandler event_handler; 167 MockAudioOutputControllerEventHandler event_handler;
168 168
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // Wait for OnCreated() to be called. 218 // Wait for OnCreated() to be called.
219 event.Wait(); 219 event.Wait();
220 220
221 ASSERT_FALSE(play_event.IsSignaled()); 221 ASSERT_FALSE(play_event.IsSignaled());
222 controller->Play(); 222 controller->Play();
223 controller->Pause(); 223 controller->Pause();
224 controller->Play(); 224 controller->Play();
225 play_event.Wait(); 225 play_event.Wait();
226 226
227 // Now stop the controller. 227 // Now stop the controller.
228 CloseAudioController(controller); 228 CloseAudioController(controller.get());
229 } 229 }
230 230
231 // Ensure state change events are handled. 231 // Ensure state change events are handled.
232 TEST_F(AudioOutputControllerTest, PlayStateChangeClose) { 232 TEST_F(AudioOutputControllerTest, PlayStateChangeClose) {
233 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); 233 scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
234 if (!audio_manager->HasAudioOutputDevices()) 234 if (!audio_manager->HasAudioOutputDevices())
235 return; 235 return;
236 236
237 MockAudioOutputControllerEventHandler event_handler; 237 MockAudioOutputControllerEventHandler event_handler;
238 base::WaitableEvent event(false, false); 238 base::WaitableEvent event(false, false);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 controller->Play(); 273 controller->Play();
274 play_event.Wait(); 274 play_event.Wait();
275 275
276 // Force a state change and wait for the stream to come back to playing state. 276 // Force a state change and wait for the stream to come back to playing state.
277 play_event.Reset(); 277 play_event.Reset();
278 audio_manager->GetMessageLoop()->PostTask(FROM_HERE, 278 audio_manager->GetMessageLoop()->PostTask(FROM_HERE,
279 base::Bind(&AudioOutputController::OnDeviceChange, controller)); 279 base::Bind(&AudioOutputController::OnDeviceChange, controller));
280 play_event.Wait(); 280 play_event.Wait();
281 281
282 // Now stop the controller. 282 // Now stop the controller.
283 CloseAudioController(controller); 283 CloseAudioController(controller.get());
284 } 284 }
285 285
286 } // namespace media 286 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_input_controller_unittest.cc ('k') | media/audio/linux/alsa_output.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698