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

Unified Diff: media/filters/video_renderer_base_unittest.cc

Issue 159476: Merge 21611 - Implemented proper pausethenseek behaviour for the media pipeli... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/video_renderer_base.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_base_unittest.cc
===================================================================
--- media/filters/video_renderer_base_unittest.cc (revision 21798)
+++ media/filters/video_renderer_base_unittest.cc (working copy)
@@ -125,9 +125,8 @@
EXPECT_EQ(0u, read_queue_.size());
}
-// Tests successful initialization, but when we immediately return an end of
-// stream frame.
-TEST_F(VideoRendererBaseTest, Initialize_NoData) {
+// Test successful initialization and preroll.
+TEST_F(VideoRendererBaseTest, Initialize_Successful) {
InSequence s;
// We expect the video size to be set.
@@ -137,66 +136,29 @@
EXPECT_CALL(*renderer_, OnInitialize(_))
.WillOnce(Return(true));
- // Set up a check point to verify that the callback hasn't been executed yet.
- EXPECT_CALL(*renderer_, CheckPoint(0));
-
- // We'll provide end-of-stream immediately, which results in an error.
- EXPECT_CALL(host_, SetError(PIPELINE_ERROR_NO_DATA));
-
- // Then we expect our callback to be executed.
+ // After finishing initialization, we expect our callback to be executed.
EXPECT_CALL(callback_, OnFilterCallback());
EXPECT_CALL(callback_, OnCallbackDestroyed());
- // Since the callbacks are on a separate thread, expect any number of calls.
- EXPECT_CALL(*renderer_, OnFrameAvailable())
- .Times(AnyNumber());
-
- // Initialize, we should expect to get a bunch of read requests.
- renderer_->Initialize(decoder_, callback_.NewCallback());
- EXPECT_EQ(3u, read_queue_.size());
-
- // Verify our callback hasn't been executed yet.
- renderer_->CheckPoint(0);
-
- // Now satisfy the read requests. Our callback should be executed after
- // exiting this loop.
- while (!read_queue_.empty()) {
- const base::TimeDelta kZero;
- scoped_refptr<VideoFrame> frame;
- VideoFrameImpl::CreateEmptyFrame(&frame);
- read_queue_.front()->Run(frame);
- delete read_queue_.front();
- read_queue_.pop_front();
- }
-}
-
-// Test successful initialization and preroll.
-TEST_F(VideoRendererBaseTest, Initialize_Successful) {
- InSequence s;
-
- // We expect the video size to be set.
- EXPECT_CALL(host_, SetVideoSize(kWidth, kHeight));
-
- // Then our subclass will be asked to initialize.
- EXPECT_CALL(*renderer_, OnInitialize(_))
- .WillOnce(Return(true));
-
- // Set up a check point to verify that the callback hasn't been executed yet.
+ // Verify the following expectations haven't run until we complete the reads.
EXPECT_CALL(*renderer_, CheckPoint(0));
- // After finishing preroll, we expect our callback to be executed.
- EXPECT_CALL(callback_, OnFilterCallback());
- EXPECT_CALL(callback_, OnCallbackDestroyed());
+ // We'll expect to get notified once due preroll completing.
+ EXPECT_CALL(*renderer_, OnFrameAvailable());
- // Since the callbacks are on a separate thread, expect any number of calls.
- EXPECT_CALL(*renderer_, OnFrameAvailable())
- .Times(AnyNumber());
+ MockFilterCallback seek_callback;
+ EXPECT_CALL(seek_callback, OnFilterCallback());
+ EXPECT_CALL(seek_callback, OnCallbackDestroyed());
- // Initialize, we should expect to get a bunch of read requests.
+ // Initialize, we shouldn't have any reads.
renderer_->Initialize(decoder_, callback_.NewCallback());
- EXPECT_EQ(3u, read_queue_.size());
+ EXPECT_EQ(0u, read_queue_.size());
- // Verify our callback hasn't been executed yet.
+ // Now seek to trigger prerolling.
+ renderer_->Seek(base::TimeDelta(), seek_callback.NewCallback());
+ EXPECT_LT(0u, read_queue_.size());
+
+ // Verify our seek callback hasn't been executed yet.
renderer_->CheckPoint(0);
// Now satisfy the read requests. Our callback should be executed after
Property changes on: media\filters\video_renderer_base_unittest.cc
___________________________________________________________________
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/media/filters/video_renderer_base_unittest.cc:r69-2775
Merged /trunk/src/media/filters/video_renderer_base_unittest.cc:r21611
« no previous file with comments | « media/filters/video_renderer_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698