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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class VideoRendererImplTest : public ::testing::Test { | 47 class VideoRendererImplTest : public ::testing::Test { |
48 public: | 48 public: |
49 VideoRendererImplTest() | 49 VideoRendererImplTest() |
50 : tick_clock_(new base::SimpleTestTickClock()), | 50 : tick_clock_(new base::SimpleTestTickClock()), |
51 decoder_(new MockVideoDecoder()), | 51 decoder_(new MockVideoDecoder()), |
52 demuxer_stream_(DemuxerStream::VIDEO) { | 52 demuxer_stream_(DemuxerStream::VIDEO) { |
53 ScopedVector<VideoDecoder> decoders; | 53 ScopedVector<VideoDecoder> decoders; |
54 decoders.push_back(decoder_); | 54 decoders.push_back(decoder_); |
55 | 55 |
56 renderer_.reset(new VideoRendererImpl(message_loop_.message_loop_proxy(), | 56 renderer_.reset(new VideoRendererImpl(message_loop_.message_loop_proxy(), |
57 &mock_cb_, | |
58 decoders.Pass(), true, | 57 decoders.Pass(), true, |
59 new MediaLog())); | 58 new MediaLog())); |
60 renderer_->SetTickClockForTesting(scoped_ptr<base::TickClock>(tick_clock_)); | 59 renderer_->SetTickClockForTesting(scoped_ptr<base::TickClock>(tick_clock_)); |
61 | 60 |
62 // Start wallclock time at a non-zero value. | 61 // Start wallclock time at a non-zero value. |
63 AdvanceWallclockTimeInMs(12345); | 62 AdvanceWallclockTimeInMs(12345); |
64 | 63 |
65 demuxer_stream_.set_video_decoder_config(TestVideoConfig::Normal()); | 64 demuxer_stream_.set_video_decoder_config(TestVideoConfig::Normal()); |
66 | 65 |
67 // We expect these to be called but we don't care how/when. | 66 // We expect these to be called but we don't care how/when. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 demuxer_stream_.set_liveness(DemuxerStream::LIVENESS_LIVE); | 101 demuxer_stream_.set_liveness(DemuxerStream::LIVENESS_LIVE); |
103 EXPECT_CALL(*decoder_, Initialize(_, _, _, _)).WillOnce( | 102 EXPECT_CALL(*decoder_, Initialize(_, _, _, _)).WillOnce( |
104 DoAll(SaveArg<3>(&output_cb_), RunCallback<2>(decoder_status))); | 103 DoAll(SaveArg<3>(&output_cb_), RunCallback<2>(decoder_status))); |
105 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); | 104 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); |
106 renderer_->Initialize( | 105 renderer_->Initialize( |
107 &demuxer_stream_, status_cb, media::SetDecryptorReadyCB(), | 106 &demuxer_stream_, status_cb, media::SetDecryptorReadyCB(), |
108 base::Bind(&VideoRendererImplTest::OnStatisticsUpdate, | 107 base::Bind(&VideoRendererImplTest::OnStatisticsUpdate, |
109 base::Unretained(this)), | 108 base::Unretained(this)), |
110 base::Bind(&StrictMock<MockCB>::BufferingStateChange, | 109 base::Bind(&StrictMock<MockCB>::BufferingStateChange, |
111 base::Unretained(&mock_cb_)), | 110 base::Unretained(&mock_cb_)), |
| 111 base::Bind(&StrictMock<MockCB>::Display, base::Unretained(&mock_cb_)), |
112 ended_event_.GetClosure(), error_event_.GetPipelineStatusCB(), | 112 ended_event_.GetClosure(), error_event_.GetPipelineStatusCB(), |
113 base::Bind(&VideoRendererImplTest::GetWallClockTime, | 113 base::Bind(&VideoRendererImplTest::GetWallClockTime, |
114 base::Unretained(this)), | 114 base::Unretained(this)), |
115 base::Bind(&VideoRendererImplTest::OnWaitingForDecryptionKey, | 115 base::Bind(&VideoRendererImplTest::OnWaitingForDecryptionKey, |
116 base::Unretained(this))); | 116 base::Unretained(this))); |
117 } | 117 } |
118 | 118 |
119 void StartPlayingFrom(int milliseconds) { | 119 void StartPlayingFrom(int milliseconds) { |
120 SCOPED_TRACE(base::StringPrintf("StartPlayingFrom(%d)", milliseconds)); | 120 SCOPED_TRACE(base::StringPrintf("StartPlayingFrom(%d)", milliseconds)); |
121 renderer_->StartPlayingFrom( | 121 renderer_->StartPlayingFrom( |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 258 } |
259 | 259 |
260 protected: | 260 protected: |
261 // Fixture members. | 261 // Fixture members. |
262 scoped_ptr<VideoRendererImpl> renderer_; | 262 scoped_ptr<VideoRendererImpl> renderer_; |
263 base::SimpleTestTickClock* tick_clock_; // Owned by |renderer_|. | 263 base::SimpleTestTickClock* tick_clock_; // Owned by |renderer_|. |
264 MockVideoDecoder* decoder_; // Owned by |renderer_|. | 264 MockVideoDecoder* decoder_; // Owned by |renderer_|. |
265 NiceMock<MockDemuxerStream> demuxer_stream_; | 265 NiceMock<MockDemuxerStream> demuxer_stream_; |
266 | 266 |
267 // Use StrictMock<T> to catch missing/extra callbacks. | 267 // Use StrictMock<T> to catch missing/extra callbacks. |
268 // TODO(dalecurtis): Mocks won't be useful for the new rendering path, we'll | 268 class MockCB { |
269 // need fake callback generators like we have for the audio path. | |
270 // http://crbug.com/473424 | |
271 class MockCB : public VideoRendererSink { | |
272 public: | 269 public: |
273 MOCK_METHOD1(Start, void(VideoRendererSink::RenderCallback*)); | 270 MOCK_METHOD1(Display, void(const scoped_refptr<VideoFrame>&)); |
274 MOCK_METHOD0(Stop, void()); | |
275 MOCK_METHOD1(PaintFrameUsingOldRenderingPath, | |
276 void(const scoped_refptr<VideoFrame>&)); | |
277 MOCK_METHOD1(BufferingStateChange, void(BufferingState)); | 271 MOCK_METHOD1(BufferingStateChange, void(BufferingState)); |
278 }; | 272 }; |
279 StrictMock<MockCB> mock_cb_; | 273 StrictMock<MockCB> mock_cb_; |
280 | 274 |
281 private: | 275 private: |
282 base::TimeTicks GetWallClockTime(base::TimeDelta time) { | 276 base::TimeTicks GetWallClockTime(base::TimeDelta time) { |
283 base::AutoLock l(lock_); | 277 base::AutoLock l(lock_); |
284 return tick_clock_->NowTicks() + (time - time_); | 278 return tick_clock_->NowTicks() + (time - time_); |
285 } | 279 } |
286 | 280 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 } | 342 } |
349 | 343 |
350 TEST_F(VideoRendererImplTest, Initialize) { | 344 TEST_F(VideoRendererImplTest, Initialize) { |
351 Initialize(); | 345 Initialize(); |
352 Destroy(); | 346 Destroy(); |
353 } | 347 } |
354 | 348 |
355 TEST_F(VideoRendererImplTest, InitializeAndStartPlayingFrom) { | 349 TEST_F(VideoRendererImplTest, InitializeAndStartPlayingFrom) { |
356 Initialize(); | 350 Initialize(); |
357 QueueFrames("0 10 20 30"); | 351 QueueFrames("0 10 20 30"); |
358 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 352 EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
359 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 353 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
360 StartPlayingFrom(0); | 354 StartPlayingFrom(0); |
361 Destroy(); | 355 Destroy(); |
362 } | 356 } |
363 | 357 |
364 TEST_F(VideoRendererImplTest, DestroyWhileInitializing) { | 358 TEST_F(VideoRendererImplTest, DestroyWhileInitializing) { |
365 CallInitialize(NewExpectedStatusCB(PIPELINE_ERROR_ABORT), false, PIPELINE_OK); | 359 CallInitialize(NewExpectedStatusCB(PIPELINE_ERROR_ABORT), false, PIPELINE_OK); |
366 Destroy(); | 360 Destroy(); |
367 } | 361 } |
368 | 362 |
369 TEST_F(VideoRendererImplTest, DestroyWhileFlushing) { | 363 TEST_F(VideoRendererImplTest, DestroyWhileFlushing) { |
370 Initialize(); | 364 Initialize(); |
371 QueueFrames("0 10 20 30"); | 365 QueueFrames("0 10 20 30"); |
372 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 366 EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
373 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 367 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
374 StartPlayingFrom(0); | 368 StartPlayingFrom(0); |
375 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)); | 369 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)); |
376 renderer_->Flush(NewExpectedClosure()); | 370 renderer_->Flush(NewExpectedClosure()); |
377 Destroy(); | 371 Destroy(); |
378 } | 372 } |
379 | 373 |
380 TEST_F(VideoRendererImplTest, Play) { | 374 TEST_F(VideoRendererImplTest, Play) { |
381 Initialize(); | 375 Initialize(); |
382 QueueFrames("0 10 20 30"); | 376 QueueFrames("0 10 20 30"); |
383 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 377 EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
384 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 378 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
385 StartPlayingFrom(0); | 379 StartPlayingFrom(0); |
386 Destroy(); | 380 Destroy(); |
387 } | 381 } |
388 | 382 |
389 TEST_F(VideoRendererImplTest, FlushWithNothingBuffered) { | 383 TEST_F(VideoRendererImplTest, FlushWithNothingBuffered) { |
390 Initialize(); | 384 Initialize(); |
391 StartPlayingFrom(0); | 385 StartPlayingFrom(0); |
392 | 386 |
393 // We shouldn't expect a buffering state change since we never reached | 387 // We shouldn't expect a buffering state change since we never reached |
394 // BUFFERING_HAVE_ENOUGH. | 388 // BUFFERING_HAVE_ENOUGH. |
395 Flush(); | 389 Flush(); |
396 Destroy(); | 390 Destroy(); |
397 } | 391 } |
398 | 392 |
399 TEST_F(VideoRendererImplTest, DecodeError_Playing) { | 393 TEST_F(VideoRendererImplTest, DecodeError_Playing) { |
400 Initialize(); | 394 Initialize(); |
401 QueueFrames("0 10 20 30"); | 395 QueueFrames("0 10 20 30"); |
402 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 396 EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
403 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 397 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
404 StartPlayingFrom(0); | 398 StartPlayingFrom(0); |
405 | 399 |
406 QueueFrames("error"); | 400 QueueFrames("error"); |
407 SatisfyPendingRead(); | 401 SatisfyPendingRead(); |
408 WaitForError(PIPELINE_ERROR_DECODE); | 402 WaitForError(PIPELINE_ERROR_DECODE); |
409 Destroy(); | 403 Destroy(); |
410 } | 404 } |
411 | 405 |
412 TEST_F(VideoRendererImplTest, DecodeError_DuringStartPlayingFrom) { | 406 TEST_F(VideoRendererImplTest, DecodeError_DuringStartPlayingFrom) { |
413 Initialize(); | 407 Initialize(); |
414 QueueFrames("error"); | 408 QueueFrames("error"); |
415 StartPlayingFrom(0); | 409 StartPlayingFrom(0); |
416 Destroy(); | 410 Destroy(); |
417 } | 411 } |
418 | 412 |
419 TEST_F(VideoRendererImplTest, StartPlayingFrom_Exact) { | 413 TEST_F(VideoRendererImplTest, StartPlayingFrom_Exact) { |
420 Initialize(); | 414 Initialize(); |
421 QueueFrames("50 60 70 80 90"); | 415 QueueFrames("50 60 70 80 90"); |
422 | 416 |
423 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(60))); | 417 EXPECT_CALL(mock_cb_, Display(HasTimestamp(60))); |
424 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 418 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
425 StartPlayingFrom(60); | 419 StartPlayingFrom(60); |
426 Destroy(); | 420 Destroy(); |
427 } | 421 } |
428 | 422 |
429 TEST_F(VideoRendererImplTest, StartPlayingFrom_RightBefore) { | 423 TEST_F(VideoRendererImplTest, StartPlayingFrom_RightBefore) { |
430 Initialize(); | 424 Initialize(); |
431 QueueFrames("50 60 70 80 90"); | 425 QueueFrames("50 60 70 80 90"); |
432 | 426 |
433 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(50))); | 427 EXPECT_CALL(mock_cb_, Display(HasTimestamp(50))); |
434 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 428 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
435 StartPlayingFrom(59); | 429 StartPlayingFrom(59); |
436 Destroy(); | 430 Destroy(); |
437 } | 431 } |
438 | 432 |
439 TEST_F(VideoRendererImplTest, StartPlayingFrom_RightAfter) { | 433 TEST_F(VideoRendererImplTest, StartPlayingFrom_RightAfter) { |
440 Initialize(); | 434 Initialize(); |
441 QueueFrames("50 60 70 80 90"); | 435 QueueFrames("50 60 70 80 90"); |
442 | 436 |
443 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(60))); | 437 EXPECT_CALL(mock_cb_, Display(HasTimestamp(60))); |
444 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 438 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
445 StartPlayingFrom(61); | 439 StartPlayingFrom(61); |
446 Destroy(); | 440 Destroy(); |
447 } | 441 } |
448 | 442 |
449 TEST_F(VideoRendererImplTest, StartPlayingFrom_LowDelay) { | 443 TEST_F(VideoRendererImplTest, StartPlayingFrom_LowDelay) { |
450 // In low-delay mode only one frame is required to finish preroll. | 444 // In low-delay mode only one frame is required to finish preroll. |
451 InitializeWithLowDelay(true); | 445 InitializeWithLowDelay(true); |
452 QueueFrames("0"); | 446 QueueFrames("0"); |
453 | 447 |
454 // Expect some amount of have enough/nothing due to only requiring one frame. | 448 // Expect some amount of have enough/nothing due to only requiring one frame. |
455 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 449 EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
456 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) | 450 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
457 .Times(AnyNumber()); | 451 .Times(AnyNumber()); |
458 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) | 452 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) |
459 .Times(AnyNumber()); | 453 .Times(AnyNumber()); |
460 StartPlayingFrom(0); | 454 StartPlayingFrom(0); |
461 | 455 |
462 QueueFrames("10"); | 456 QueueFrames("10"); |
463 SatisfyPendingRead(); | 457 SatisfyPendingRead(); |
464 | 458 |
465 WaitableMessageLoopEvent event; | 459 WaitableMessageLoopEvent event; |
466 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(10))) | 460 EXPECT_CALL(mock_cb_, Display(HasTimestamp(10))) |
467 .WillOnce(RunClosure(event.GetClosure())); | 461 .WillOnce(RunClosure(event.GetClosure())); |
468 AdvanceTimeInMs(10); | 462 AdvanceTimeInMs(10); |
469 event.RunAndWait(); | 463 event.RunAndWait(); |
470 | 464 |
471 Destroy(); | 465 Destroy(); |
472 } | 466 } |
473 | 467 |
474 // Verify that a late decoder response doesn't break invariants in the renderer. | 468 // Verify that a late decoder response doesn't break invariants in the renderer. |
475 TEST_F(VideoRendererImplTest, DestroyDuringOutstandingRead) { | 469 TEST_F(VideoRendererImplTest, DestroyDuringOutstandingRead) { |
476 Initialize(); | 470 Initialize(); |
477 QueueFrames("0 10 20 30"); | 471 QueueFrames("0 10 20 30"); |
478 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 472 EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
479 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 473 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
480 StartPlayingFrom(0); | 474 StartPlayingFrom(0); |
481 | 475 |
482 // Check that there is an outstanding Read() request. | 476 // Check that there is an outstanding Read() request. |
483 EXPECT_TRUE(IsReadPending()); | 477 EXPECT_TRUE(IsReadPending()); |
484 | 478 |
485 Destroy(); | 479 Destroy(); |
486 } | 480 } |
487 | 481 |
488 TEST_F(VideoRendererImplTest, VideoDecoder_InitFailure) { | 482 TEST_F(VideoRendererImplTest, VideoDecoder_InitFailure) { |
489 InitializeRenderer(DECODER_ERROR_NOT_SUPPORTED, false); | 483 InitializeRenderer(DECODER_ERROR_NOT_SUPPORTED, false); |
490 Destroy(); | 484 Destroy(); |
491 } | 485 } |
492 | 486 |
493 TEST_F(VideoRendererImplTest, Underflow) { | 487 TEST_F(VideoRendererImplTest, Underflow) { |
494 Initialize(); | 488 Initialize(); |
495 QueueFrames("0 10 20 30"); | 489 QueueFrames("0 10 20 30"); |
496 | 490 |
497 { | 491 { |
498 WaitableMessageLoopEvent event; | 492 WaitableMessageLoopEvent event; |
499 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 493 EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
500 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) | 494 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
501 .WillOnce(RunClosure(event.GetClosure())); | 495 .WillOnce(RunClosure(event.GetClosure())); |
502 StartPlayingFrom(0); | 496 StartPlayingFrom(0); |
503 event.RunAndWait(); | 497 event.RunAndWait(); |
504 Mock::VerifyAndClearExpectations(&mock_cb_); | 498 Mock::VerifyAndClearExpectations(&mock_cb_); |
505 } | 499 } |
506 | 500 |
507 // Advance time slightly, but enough to exceed the duration of the last frame. | 501 // Advance time slightly, but enough to exceed the duration of the last frame. |
508 // Frames should be dropped and we should NOT signal having nothing. | 502 // Frames should be dropped and we should NOT signal having nothing. |
509 { | 503 { |
510 SCOPED_TRACE("Waiting for frame drops"); | 504 SCOPED_TRACE("Waiting for frame drops"); |
511 WaitableMessageLoopEvent event; | 505 WaitableMessageLoopEvent event; |
512 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(10))) | 506 EXPECT_CALL(mock_cb_, Display(HasTimestamp(10))).Times(0); |
513 .Times(0); | 507 EXPECT_CALL(mock_cb_, Display(HasTimestamp(20))).Times(0); |
514 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(20))) | 508 EXPECT_CALL(mock_cb_, Display(HasTimestamp(30))) |
515 .Times(0); | |
516 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(30))) | |
517 .WillOnce(RunClosure(event.GetClosure())); | 509 .WillOnce(RunClosure(event.GetClosure())); |
518 AdvanceTimeInMs(31); | 510 AdvanceTimeInMs(31); |
519 event.RunAndWait(); | 511 event.RunAndWait(); |
520 Mock::VerifyAndClearExpectations(&mock_cb_); | 512 Mock::VerifyAndClearExpectations(&mock_cb_); |
521 } | 513 } |
522 | 514 |
523 // Advance time more. Now we should signal having nothing. And put | 515 // Advance time more, such that a new frame should have been displayed by now. |
524 // the last frame up for display. | |
525 { | 516 { |
526 SCOPED_TRACE("Waiting for BUFFERING_HAVE_NOTHING"); | 517 SCOPED_TRACE("Waiting for BUFFERING_HAVE_NOTHING"); |
527 WaitableMessageLoopEvent event; | 518 WaitableMessageLoopEvent event; |
528 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) | 519 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) |
529 .WillOnce(RunClosure(event.GetClosure())); | 520 .WillOnce(RunClosure(event.GetClosure())); |
530 AdvanceWallclockTimeInMs(9); | 521 AdvanceWallclockTimeInMs(9); |
531 event.RunAndWait(); | 522 event.RunAndWait(); |
532 Mock::VerifyAndClearExpectations(&mock_cb_); | 523 Mock::VerifyAndClearExpectations(&mock_cb_); |
533 } | 524 } |
534 | 525 |
535 // Receiving end of stream should signal having enough. | 526 // Receiving end of stream should signal having enough. |
536 { | 527 { |
537 SCOPED_TRACE("Waiting for BUFFERING_HAVE_ENOUGH"); | 528 SCOPED_TRACE("Waiting for BUFFERING_HAVE_ENOUGH"); |
538 WaitableMessageLoopEvent event; | 529 WaitableMessageLoopEvent event; |
539 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) | 530 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
540 .WillOnce(RunClosure(event.GetClosure())); | 531 .WillOnce(RunClosure(event.GetClosure())); |
541 SatisfyPendingReadWithEndOfStream(); | 532 SatisfyPendingReadWithEndOfStream(); |
542 event.RunAndWait(); | 533 event.RunAndWait(); |
543 } | 534 } |
544 | 535 |
545 WaitForEnded(); | 536 WaitForEnded(); |
546 Destroy(); | 537 Destroy(); |
547 } | 538 } |
548 | 539 |
549 } // namespace media | 540 } // namespace media |
OLD | NEW |