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

Side by Side Diff: content/browser/renderer_host/media/audio_renderer_host_unittest.cc

Issue 11413078: Tab Audio Capture: Browser-side connect/disconnect functionality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify! Created 8 years 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
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/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/sync_socket.h" 10 #include "base/sync_socket.h"
11 #include "content/browser/browser_thread_impl.h" 11 #include "content/browser/browser_thread_impl.h"
12 #include "content/browser/renderer_host/media/audio_renderer_host.h" 12 #include "content/browser/renderer_host/media/audio_renderer_host.h"
13 #include "content/browser/renderer_host/media/mock_media_observer.h" 13 #include "content/browser/renderer_host/media/mock_media_observer.h"
14 #include "content/common/media/audio_messages.h" 14 #include "content/common/media/audio_messages.h"
15 #include "ipc/ipc_message_utils.h" 15 #include "ipc/ipc_message_utils.h"
16 #include "media/audio/audio_manager.h" 16 #include "media/audio/audio_manager.h"
17 #include "media/audio/fake_audio_output_stream.h" 17 #include "media/audio/fake_audio_output_stream.h"
18 #include "net/url_request/url_request_context.h" 18 #include "net/url_request/url_request_context.h"
19 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 using ::testing::_; 22 using ::testing::_;
23 using ::testing::AtLeast; 23 using ::testing::AtLeast;
24 using ::testing::DoAll; 24 using ::testing::DoAll;
25 using ::testing::InSequence; 25 using ::testing::InSequence;
26 using ::testing::InvokeWithoutArgs; 26 using ::testing::Invoke;
27 using ::testing::Return; 27 using ::testing::Return;
28 using ::testing::SaveArg; 28 using ::testing::SaveArg;
29 using ::testing::SetArgumentPointee; 29 using ::testing::SetArgumentPointee;
30 30
31 namespace content { 31 namespace content {
32 32
33 static const int kRenderProcessId = 1;
34 static const int kRenderViewId = 4;
33 static const int kStreamId = 50; 35 static const int kStreamId = 50;
34 36
35 static bool IsRunningHeadless() { 37 static bool IsRunningHeadless() {
36 scoped_ptr<base::Environment> env(base::Environment::Create()); 38 scoped_ptr<base::Environment> env(base::Environment::Create());
37 if (env->HasVar("CHROME_HEADLESS")) 39 if (env->HasVar("CHROME_HEADLESS"))
38 return true; 40 return true;
39 return false; 41 return false;
40 } 42 }
41 43
42 class MockAudioRendererHost : public AudioRendererHost { 44 class MockAudioRendererHost : public AudioRendererHost {
43 public: 45 public:
44 explicit MockAudioRendererHost( 46 explicit MockAudioRendererHost(
45 media::AudioManager* audio_manager, 47 media::AudioManager* audio_manager,
46 MediaObserver* media_observer) 48 MediaObserver* media_observer)
47 : AudioRendererHost(audio_manager, media_observer), 49 : AudioRendererHost(kRenderProcessId, audio_manager, media_observer),
48 shared_memory_length_(0) { 50 shared_memory_length_(0) {
49 } 51 }
50 52
51 // A list of mock methods. 53 // A list of mock methods.
52 MOCK_METHOD2(OnStreamCreated, 54 MOCK_METHOD2(OnStreamCreated,
53 void(int stream_id, int length)); 55 void(int stream_id, int length));
54 MOCK_METHOD1(OnStreamPlaying, void(int stream_id)); 56 MOCK_METHOD1(OnStreamPlaying, void(int stream_id));
55 MOCK_METHOD1(OnStreamPaused, void(int stream_id)); 57 MOCK_METHOD1(OnStreamPaused, void(int stream_id));
56 MOCK_METHOD1(OnStreamError, void(int stream_id)); 58 MOCK_METHOD1(OnStreamError, void(int stream_id));
57 MOCK_METHOD2(OnStreamVolume, void(int stream_id, double volume)); 59 MOCK_METHOD2(OnStreamVolume, void(int stream_id, double volume));
58 60
59 private: 61 private:
60 virtual ~MockAudioRendererHost() { 62 virtual ~MockAudioRendererHost() {
61 // Make sure all audio streams have been deleted. 63 // Make sure all audio streams have been deleted.
62 EXPECT_TRUE(audio_entries_.empty()); 64 EXPECT_TRUE(audio_entries_.empty());
65 // Make sure no mirroring sessions are active.
66 EXPECT_TRUE(mirror_sessions_.empty());
63 } 67 }
64 68
65 // This method is used to dispatch IPC messages to the renderer. We intercept 69 // This method is used to dispatch IPC messages to the renderer. We intercept
66 // these messages here and dispatch to our mock methods to verify the 70 // these messages here and dispatch to our mock methods to verify the
67 // conversation between this object and the renderer. 71 // conversation between this object and the renderer.
68 virtual bool Send(IPC::Message* message) { 72 virtual bool Send(IPC::Message* message) {
69 CHECK(message); 73 CHECK(message);
70 74
71 // In this method we dispatch the messages to the according handlers as if 75 // In this method we dispatch the messages to the according handlers as if
72 // we are the renderer. 76 // we are the renderer.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 133 }
130 } 134 }
131 135
132 scoped_ptr<base::SharedMemory> shared_memory_; 136 scoped_ptr<base::SharedMemory> shared_memory_;
133 scoped_ptr<base::SyncSocket> sync_socket_; 137 scoped_ptr<base::SyncSocket> sync_socket_;
134 uint32 shared_memory_length_; 138 uint32 shared_memory_length_;
135 139
136 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererHost); 140 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererHost);
137 }; 141 };
138 142
143 class MockMirroringDestination
144 : public AudioRendererHost::MirroringDestination {
145 public:
146 MockMirroringDestination(media::AudioManager* audio_manager)
147 : audio_manager_(audio_manager) {}
148
149 MOCK_METHOD1(AddInput,
150 media::AudioOutputStream*(const media::AudioParameters& params));
151
152 media::AudioOutputStream* SimulateAddInput(
153 const media::AudioParameters& params) {
154 const media::AudioParameters fake_params(
155 media::AudioParameters::AUDIO_FAKE, params.channel_layout(),
156 params.sample_rate(), params.bits_per_sample(),
157 params.frames_per_buffer());
158 return audio_manager_->MakeAudioOutputStream(fake_params);
159 }
160
161 private:
162 virtual ~MockMirroringDestination() {}
163
164 media::AudioManager* const audio_manager_;
165
166 DISALLOW_COPY_AND_ASSIGN(MockMirroringDestination);
167 };
168
139 ACTION_P(QuitMessageLoop, message_loop) { 169 ACTION_P(QuitMessageLoop, message_loop) {
140 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 170 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
141 } 171 }
142 172
143 class AudioRendererHostTest : public testing::Test { 173 class AudioRendererHostTest : public testing::Test {
144 public: 174 public:
145 AudioRendererHostTest() 175 AudioRendererHostTest()
146 : mock_stream_(true) { 176 : mock_stream_(true) {
147 } 177 }
148 178
149 protected: 179 protected:
150 virtual void SetUp() { 180 virtual void SetUp() {
151 // Create a message loop so AudioRendererHost can use it. 181 // Create a message loop so AudioRendererHost can use it.
152 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); 182 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO));
153 183
154 // Claim to be on both the UI and IO threads to pass all the DCHECKS. 184 // Claim to be on both the UI and IO threads to pass all the DCHECKS.
155 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO, 185 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO,
156 message_loop_.get())); 186 message_loop_.get()));
157 ui_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, 187 ui_thread_.reset(new BrowserThreadImpl(BrowserThread::UI,
158 message_loop_.get())); 188 message_loop_.get()));
159 audio_manager_.reset(media::AudioManager::Create()); 189 audio_manager_.reset(media::AudioManager::Create());
160 observer_.reset(new MockMediaObserver()); 190 observer_.reset(new MockMediaObserver());
161 host_ = new MockAudioRendererHost(audio_manager_.get(), observer_.get()); 191 host_ = new MockAudioRendererHost(audio_manager_.get(), observer_.get());
162 192 destination_ = new MockMirroringDestination(audio_manager_.get());
163 // Expect the audio stream will be deleted. 193 another_destination_ = new MockMirroringDestination(audio_manager_.get());
164 EXPECT_CALL(*observer_, OnDeleteAudioStream(_, kStreamId));
165 194
166 // Simulate IPC channel connected. 195 // Simulate IPC channel connected.
167 host_->OnChannelConnected(base::GetCurrentProcId()); 196 host_->OnChannelConnected(base::GetCurrentProcId());
197
198 if (!IsRunningHeadless())
199 EnableRealDevice();
168 } 200 }
169 201
170 virtual void TearDown() { 202 virtual void TearDown() {
171 // Simulate closing the IPC channel. 203 // Simulate closing the IPC channel.
172 host_->OnChannelClosing(); 204 host_->OnChannelClosing();
173 205
174 // Release the reference to the mock object. The object will be destructed 206 // Release the reference to the mock objects. The MockAudioRendererHost
175 // on message_loop_. 207 // will be destroyed on message_loop_.
208 another_destination_ = NULL;
209 destination_ = NULL;
176 host_ = NULL; 210 host_ = NULL;
177 211
178 // We need to continue running message_loop_ to complete all destructions. 212 // We need to continue running message_loop_ to complete all destructions.
179 SyncWithAudioThread(); 213 SyncWithAudioThread();
180 214
181 audio_manager_.reset(); 215 audio_manager_.reset();
182 216
183 io_thread_.reset(); 217 io_thread_.reset();
184 ui_thread_.reset(); 218 ui_thread_.reset();
185 } 219 }
(...skipping 15 matching lines...) Expand all
201 235
202 media::AudioParameters params( 236 media::AudioParameters params(
203 format, media::CHANNEL_LAYOUT_STEREO, 237 format, media::CHANNEL_LAYOUT_STEREO,
204 media::AudioParameters::kAudioCDSampleRate, 16, 238 media::AudioParameters::kAudioCDSampleRate, 16,
205 media::AudioParameters::kAudioCDSampleRate / 10); 239 media::AudioParameters::kAudioCDSampleRate / 10);
206 240
207 // Send a create stream message to the audio output stream and wait until 241 // Send a create stream message to the audio output stream and wait until
208 // we receive the created message. 242 // we receive the created message.
209 host_->OnCreateStream(kStreamId, params, 0); 243 host_->OnCreateStream(kStreamId, params, 0);
210 message_loop_->Run(); 244 message_loop_->Run();
245
246 // Simulate the renderer process associating a stream with a render view.
247 host_->OnAssociateStreamWithProducer(kStreamId, kRenderViewId);
248 message_loop_->RunUntilIdle();
249
250 // Expect the audio stream will be deleted at some later point.
251 EXPECT_CALL(*observer_, OnDeleteAudioStream(_, kStreamId));
211 } 252 }
212 253
213 void Close() { 254 void Close() {
214 EXPECT_CALL(*observer_, 255 EXPECT_CALL(*observer_,
215 OnSetAudioStreamStatus(_, kStreamId, "closed")); 256 OnSetAudioStreamStatus(_, kStreamId, "closed"));
216 257
217 // Send a message to AudioRendererHost to tell it we want to close the 258 // Send a message to AudioRendererHost to tell it we want to close the
218 // stream. 259 // stream.
219 host_->OnCloseStream(kStreamId); 260 host_->OnCloseStream(kStreamId);
220 message_loop_->RunUntilIdle(); 261 message_loop_->RunUntilIdle();
221 } 262 }
222 263
223 void Play() { 264 void Play() {
224 EXPECT_CALL(*observer_, 265 EXPECT_CALL(*observer_,
225 OnSetAudioStreamPlaying(_, kStreamId, true)); 266 OnSetAudioStreamPlaying(_, kStreamId, true));
226 EXPECT_CALL(*host_, OnStreamPlaying(kStreamId)) 267 EXPECT_CALL(*host_, OnStreamPlaying(kStreamId))
227 .WillOnce(QuitMessageLoop(message_loop_.get())); 268 .WillRepeatedly(QuitMessageLoop(message_loop_.get()));
228 269
229 host_->OnPlayStream(kStreamId); 270 host_->OnPlayStream(kStreamId);
230 message_loop_->Run(); 271 message_loop_->Run();
231 } 272 }
232 273
233 void Pause() { 274 void Pause() {
234 EXPECT_CALL(*observer_, 275 EXPECT_CALL(*observer_,
235 OnSetAudioStreamPlaying(_, kStreamId, false)); 276 OnSetAudioStreamPlaying(_, kStreamId, false));
236 EXPECT_CALL(*host_, OnStreamPaused(kStreamId)) 277 EXPECT_CALL(*host_, OnStreamPaused(kStreamId))
237 .WillOnce(QuitMessageLoop(message_loop_.get())); 278 .WillOnce(QuitMessageLoop(message_loop_.get()));
238 279
239 host_->OnPauseStream(kStreamId); 280 host_->OnPauseStream(kStreamId);
240 message_loop_->Run(); 281 message_loop_->Run();
241 } 282 }
242 283
243 void SetVolume(double volume) { 284 void SetVolume(double volume) {
244 EXPECT_CALL(*observer_, 285 EXPECT_CALL(*observer_,
245 OnSetAudioStreamVolume(_, kStreamId, volume)); 286 OnSetAudioStreamVolume(_, kStreamId, volume));
246 287
247 host_->OnSetVolume(kStreamId, volume); 288 host_->OnSetVolume(kStreamId, volume);
248 message_loop_->RunUntilIdle(); 289 message_loop_->RunUntilIdle();
249 } 290 }
250 291
292 void StartMirroringTo(MockMirroringDestination* dest,
293 int expected_inputs_seen) {
294 if (expected_inputs_seen > 0) {
295 EXPECT_CALL(*dest, AddInput(_))
296 .Times(expected_inputs_seen)
297 .WillRepeatedly(
298 Invoke(dest, &MockMirroringDestination::SimulateAddInput));
299 }
300
301 AudioRendererHost::StartMirroring(kRenderProcessId, kRenderViewId, dest);
302 message_loop_->RunUntilIdle();
303 }
304
305 void StopMirroringTo(MockMirroringDestination* dest) {
306 AudioRendererHost::StopMirroring(kRenderProcessId, kRenderViewId, dest);
307 message_loop_->RunUntilIdle();
308 }
309
251 void SimulateError() { 310 void SimulateError() {
252 EXPECT_CALL(*observer_, 311 EXPECT_CALL(*observer_,
253 OnSetAudioStreamStatus(_, kStreamId, "error")); 312 OnSetAudioStreamStatus(_, kStreamId, "error"));
254 // Find the first AudioOutputController in the AudioRendererHost. 313 // Find the first AudioOutputController in the AudioRendererHost.
255 CHECK(host_->audio_entries_.size()) 314 CHECK(host_->audio_entries_.size())
256 << "Calls Create() before calling this method"; 315 << "Calls Create() before calling this method";
257 media::AudioOutputController* controller = 316 media::AudioOutputController* controller =
258 host_->LookupControllerByIdForTesting(kStreamId); 317 host_->LookupControllerByIdForTesting(kStreamId);
259 CHECK(controller) << "AudioOutputController not found"; 318 CHECK(controller) << "AudioOutputController not found";
260 319
(...skipping 29 matching lines...) Expand all
290 // to the thread that itself owns. 349 // to the thread that itself owns.
291 message_loop_->PostTask( 350 message_loop_->PostTask(
292 FROM_HERE, base::Bind(&PostQuitOnAudioThread, 351 FROM_HERE, base::Bind(&PostQuitOnAudioThread,
293 base::Unretained(audio_manager_.get()), 352 base::Unretained(audio_manager_.get()),
294 message_loop_.get())); 353 message_loop_.get()));
295 message_loop_->Run(); 354 message_loop_->Run();
296 } 355 }
297 356
298 void EnableRealDevice() { mock_stream_ = false; } 357 void EnableRealDevice() { mock_stream_ = false; }
299 358
359 protected:
360 // Accessors for testing mirroring to one or two destinations.
361 MockMirroringDestination* destination() const {
362 return destination_;
363 }
364 MockMirroringDestination* another_destination() const {
365 return another_destination_;
366 }
367
300 private: 368 private:
301 bool mock_stream_; 369 bool mock_stream_;
302 scoped_ptr<MockMediaObserver> observer_; 370 scoped_ptr<MockMediaObserver> observer_;
303 scoped_refptr<MockAudioRendererHost> host_; 371 scoped_refptr<MockAudioRendererHost> host_;
372 scoped_refptr<MockMirroringDestination> destination_;
373 scoped_refptr<MockMirroringDestination> another_destination_;
304 scoped_ptr<MessageLoop> message_loop_; 374 scoped_ptr<MessageLoop> message_loop_;
305 scoped_ptr<BrowserThreadImpl> io_thread_; 375 scoped_ptr<BrowserThreadImpl> io_thread_;
306 scoped_ptr<BrowserThreadImpl> ui_thread_; 376 scoped_ptr<BrowserThreadImpl> ui_thread_;
307 scoped_ptr<media::AudioManager> audio_manager_; 377 scoped_ptr<media::AudioManager> audio_manager_;
308 378
309 DISALLOW_COPY_AND_ASSIGN(AudioRendererHostTest); 379 DISALLOW_COPY_AND_ASSIGN(AudioRendererHostTest);
310 }; 380 };
311 381
312 TEST_F(AudioRendererHostTest, CreateAndClose) { 382 TEST_F(AudioRendererHostTest, CreateAndClose) {
313 if (!IsRunningHeadless())
314 EnableRealDevice();
315
316 Create(); 383 Create();
317 Close(); 384 Close();
318 } 385 }
319 386
320 // Simulate the case where a stream is not properly closed. 387 // Simulate the case where a stream is not properly closed.
321 TEST_F(AudioRendererHostTest, CreateAndShutdown) { 388 TEST_F(AudioRendererHostTest, CreateAndShutdown) {
322 if (!IsRunningHeadless())
323 EnableRealDevice();
324
325 Create(); 389 Create();
326 } 390 }
327 391
328 TEST_F(AudioRendererHostTest, CreatePlayAndClose) { 392 TEST_F(AudioRendererHostTest, CreatePlayAndClose) {
329 if (!IsRunningHeadless())
330 EnableRealDevice();
331
332 Create(); 393 Create();
333 Play(); 394 Play();
334 Close(); 395 Close();
335 } 396 }
336 397
337 TEST_F(AudioRendererHostTest, CreatePlayPauseAndClose) { 398 TEST_F(AudioRendererHostTest, CreatePlayPauseAndClose) {
338 if (!IsRunningHeadless())
339 EnableRealDevice();
340
341 Create(); 399 Create();
342 Play(); 400 Play();
343 Pause(); 401 Pause();
344 Close(); 402 Close();
345 } 403 }
346 404
347 TEST_F(AudioRendererHostTest, SetVolume) { 405 TEST_F(AudioRendererHostTest, SetVolume) {
348 if (!IsRunningHeadless())
349 EnableRealDevice();
350
351 Create(); 406 Create();
352 SetVolume(0.5); 407 SetVolume(0.5);
353 Play(); 408 Play();
354 Pause(); 409 Pause();
355 Close(); 410 Close();
356 } 411 }
357 412
358 // Simulate the case where a stream is not properly closed. 413 // Simulate the case where a stream is not properly closed.
359 TEST_F(AudioRendererHostTest, CreatePlayAndShutdown) { 414 TEST_F(AudioRendererHostTest, CreatePlayAndShutdown) {
360 if (!IsRunningHeadless())
361 EnableRealDevice();
362
363 Create(); 415 Create();
364 Play(); 416 Play();
365 } 417 }
366 418
367 // Simulate the case where a stream is not properly closed. 419 // Simulate the case where a stream is not properly closed.
368 TEST_F(AudioRendererHostTest, CreatePlayPauseAndShutdown) { 420 TEST_F(AudioRendererHostTest, CreatePlayPauseAndShutdown) {
369 if (!IsRunningHeadless())
370 EnableRealDevice();
371
372 Create(); 421 Create();
373 Play(); 422 Play();
374 Pause(); 423 Pause();
375 } 424 }
376 425
426 TEST_F(AudioRendererHostTest, MirroringOfNothing) {
427 StartMirroringTo(destination(), 0);
428 StopMirroringTo(destination());
429 }
430
431 TEST_F(AudioRendererHostTest, StreamLifetimeAroundMirroringSession) {
432 Create();
433 Play();
434 StartMirroringTo(destination(), 1);
435 StopMirroringTo(destination());
436 Close();
437 }
438
439 TEST_F(AudioRendererHostTest, PauseStreamDuringMirroringSession) {
440 Create();
441 Play();
442 StartMirroringTo(destination(), 1);
443 Pause();
444 StopMirroringTo(destination());
445 Close();
446 }
447
448 TEST_F(AudioRendererHostTest, StreamLifetimeWithinMirroringSession) {
449 StartMirroringTo(destination(), 1);
450 Create();
451 Play();
452 Close();
453 StopMirroringTo(destination());
454 }
455
456 TEST_F(AudioRendererHostTest, StreamLifetimeAroundTwoMirroringSessions) {
457 Create();
458 Play();
459 StartMirroringTo(destination(), 1);
460 StopMirroringTo(destination());
461 StartMirroringTo(another_destination(), 1);
462 StopMirroringTo(another_destination());
463 Close();
464 }
465
466 TEST_F(AudioRendererHostTest, StreamLifetimeWithinTwoMirroringSessions) {
467 StartMirroringTo(destination(), 1);
468 Create();
469 Play();
470 StopMirroringTo(destination());
471 StartMirroringTo(another_destination(), 1);
472 Close();
473 StopMirroringTo(another_destination());
474 }
475
476 TEST_F(AudioRendererHostTest, StreamSwitchesMirroringSessions) {
477 StartMirroringTo(destination(), 1);
478 Create();
479 Play();
480 StartMirroringTo(another_destination(), 1);
481 Close();
482 StopMirroringTo(another_destination());
483 StopMirroringTo(destination()); // This should be a no-op.
484 }
485
486 TEST_F(AudioRendererHostTest, SwitchMirroringDestinationNoStreams) {
487 StartMirroringTo(destination(), 0);
488 StartMirroringTo(another_destination(), 0);
489 StopMirroringTo(another_destination());
490 }
491
492 // Simulate the case where mirroring was not stopped before shutdown.
493 TEST_F(AudioRendererHostTest, StartMirroringNothingAndShutdown) {
494 StartMirroringTo(destination(), 0);
495 }
496
497 // Simulate the case where mirroring was not stopped before shutdown, and a
498 // stream was being mirrored.
499 TEST_F(AudioRendererHostTest, StartMirroringSomethingAndShutdown) {
500 StartMirroringTo(destination(), 1);
501 Create();
502 Play();
503 }
504
377 TEST_F(AudioRendererHostTest, SimulateError) { 505 TEST_F(AudioRendererHostTest, SimulateError) {
378 if (!IsRunningHeadless())
379 EnableRealDevice();
380
381 Create(); 506 Create();
382 Play(); 507 Play();
383 SimulateError(); 508 SimulateError();
384 } 509 }
385 510
386 // Simulate the case when an error is generated on the browser process, 511 // Simulate the case when an error is generated on the browser process,
387 // the audio device is closed but the render process try to close the 512 // the audio device is closed but the render process try to close the
388 // audio stream again. 513 // audio stream again.
389 TEST_F(AudioRendererHostTest, SimulateErrorAndClose) { 514 TEST_F(AudioRendererHostTest, SimulateErrorAndClose) {
390 if (!IsRunningHeadless())
391 EnableRealDevice();
392
393 Create(); 515 Create();
394 Play(); 516 Play();
395 SimulateError(); 517 SimulateError();
396 Close(); 518 Close();
397 } 519 }
398 520
399 // TODO(hclam): Add tests for data conversation in low latency mode. 521 // TODO(hclam): Add tests for data conversation in low latency mode.
400 522
401 } // namespace content 523 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698