| Index: content/renderer/media/video_frame_compositor_unittest.cc
|
| diff --git a/content/renderer/media/video_frame_compositor_unittest.cc b/content/renderer/media/video_frame_compositor_unittest.cc
|
| index 7aecad0897fbab4a623bceee7d8ab0ef8b5fbf8c..6669825e913c049133c80e06d7ca981d60d6facb 100644
|
| --- a/content/renderer/media/video_frame_compositor_unittest.cc
|
| +++ b/content/renderer/media/video_frame_compositor_unittest.cc
|
| @@ -3,7 +3,6 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/bind.h"
|
| -#include "base/message_loop/message_loop.h"
|
| #include "cc/layers/video_frame_provider.h"
|
| #include "content/renderer/media/video_frame_compositor.h"
|
| #include "media/base/video_frame.h"
|
| @@ -18,7 +17,6 @@ class VideoFrameCompositorTest : public testing::Test,
|
| public:
|
| VideoFrameCompositorTest()
|
| : compositor_(new VideoFrameCompositor(
|
| - message_loop_.message_loop_proxy(),
|
| base::Bind(&VideoFrameCompositorTest::NaturalSizeChanged,
|
| base::Unretained(this)),
|
| base::Bind(&VideoFrameCompositorTest::OpacityChanged,
|
| @@ -27,20 +25,14 @@ class VideoFrameCompositorTest : public testing::Test,
|
| natural_size_changed_count_(0),
|
| opacity_changed_count_(0),
|
| opaque_(false) {
|
| - provider()->SetVideoFrameProviderClient(this);
|
| + compositor_->SetVideoFrameProviderClient(this);
|
| }
|
|
|
| virtual ~VideoFrameCompositorTest() {
|
| - provider()->SetVideoFrameProviderClient(NULL);
|
| - compositor_.reset();
|
| - message_loop_.RunUntilIdle();
|
| + compositor_->SetVideoFrameProviderClient(NULL);
|
| }
|
|
|
| - base::MessageLoop* message_loop() { return &message_loop_; }
|
| VideoFrameCompositor* compositor() { return compositor_.get(); }
|
| - cc::VideoFrameProvider* provider() {
|
| - return compositor_->GetVideoFrameProvider();
|
| - }
|
| int did_receive_frame_count() { return did_receive_frame_count_; }
|
| int natural_size_changed_count() { return natural_size_changed_count_; }
|
| gfx::Size natural_size() { return natural_size_; }
|
| @@ -66,7 +58,6 @@ class VideoFrameCompositorTest : public testing::Test,
|
| opaque_ = opaque;
|
| }
|
|
|
| - base::MessageLoop message_loop_;
|
| scoped_ptr<VideoFrameCompositor> compositor_;
|
| int did_receive_frame_count_;
|
| int natural_size_changed_count_;
|
| @@ -78,21 +69,17 @@ class VideoFrameCompositorTest : public testing::Test,
|
| };
|
|
|
| TEST_F(VideoFrameCompositorTest, InitialValues) {
|
| - EXPECT_TRUE(compositor()->GetVideoFrameProvider());
|
| EXPECT_FALSE(compositor()->GetCurrentFrame());
|
| - EXPECT_EQ(0u, compositor()->GetFramesDroppedBeforeCompositorWasNotified());
|
| }
|
|
|
| TEST_F(VideoFrameCompositorTest, UpdateCurrentFrame) {
|
| scoped_refptr<VideoFrame> expected = VideoFrame::CreateEOSFrame();
|
|
|
| + // Should notify compositor synchronously.
|
| + EXPECT_EQ(0, did_receive_frame_count());
|
| compositor()->UpdateCurrentFrame(expected);
|
| scoped_refptr<VideoFrame> actual = compositor()->GetCurrentFrame();
|
| EXPECT_EQ(expected, actual);
|
| -
|
| - // Should notify compositor asynchronously.
|
| - EXPECT_EQ(0, did_receive_frame_count());
|
| - message_loop()->RunUntilIdle();
|
| EXPECT_EQ(1, did_receive_frame_count());
|
| }
|
|
|
| @@ -172,38 +159,4 @@ TEST_F(VideoFrameCompositorTest, OpacityChanged) {
|
| EXPECT_EQ(2, opacity_changed_count());
|
| }
|
|
|
| -TEST_F(VideoFrameCompositorTest, GetFramesDroppedBeforeCompositorWasNotified) {
|
| - scoped_refptr<VideoFrame> frame = VideoFrame::CreateEOSFrame();
|
| -
|
| - compositor()->UpdateCurrentFrame(frame);
|
| - EXPECT_EQ(0, did_receive_frame_count());
|
| - EXPECT_EQ(0u, compositor()->GetFramesDroppedBeforeCompositorWasNotified());
|
| -
|
| - // Should not increment if we finished notifying the compositor.
|
| - //
|
| - // This covers the normal scenario where the compositor is getting
|
| - // notifications in a timely manner.
|
| - message_loop()->RunUntilIdle();
|
| - compositor()->UpdateCurrentFrame(frame);
|
| - EXPECT_EQ(1, did_receive_frame_count());
|
| - EXPECT_EQ(0u, compositor()->GetFramesDroppedBeforeCompositorWasNotified());
|
| -
|
| - // Should increment if we didn't notify the compositor.
|
| - //
|
| - // This covers the scenario where the compositor is falling behind.
|
| - // Consider it dropped.
|
| - message_loop()->RunUntilIdle();
|
| - compositor()->UpdateCurrentFrame(frame);
|
| - compositor()->UpdateCurrentFrame(frame);
|
| - EXPECT_EQ(2, did_receive_frame_count());
|
| - EXPECT_EQ(1u, compositor()->GetFramesDroppedBeforeCompositorWasNotified());
|
| -
|
| - // Shouldn't overflow.
|
| - compositor()->SetFramesDroppedBeforeCompositorWasNotifiedForTesting(
|
| - kuint32max);
|
| - compositor()->UpdateCurrentFrame(frame);
|
| - EXPECT_EQ(kuint32max,
|
| - compositor()->GetFramesDroppedBeforeCompositorWasNotified());
|
| -}
|
| -
|
| } // namespace content
|
|
|