Commit 6a99cb1e authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Remove the rest of now-always-on UseSurfaceLayerForVideo feature.

R=​liberato

Fixed: 1134146
Change-Id: I0792f30c252eb8773b5c38a1e72ffb5c5c91cbb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2453917
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Frank Liberato <liberato@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814425}
parent 5791bf84
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/gmock_callback_support.h" #include "base/test/gmock_callback_support.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h" #include "base/test/simple_test_tick_clock.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h" #include "components/viz/common/frame_sinks/begin_frame_args.h"
#include "components/viz/common/surfaces/frame_sink_id.h" #include "components/viz/common/surfaces/frame_sink_id.h"
...@@ -49,40 +48,24 @@ class MockWebVideoFrameSubmitter : public blink::WebVideoFrameSubmitter { ...@@ -49,40 +48,24 @@ class MockWebVideoFrameSubmitter : public blink::WebVideoFrameSubmitter {
}; };
class VideoFrameCompositorTest : public VideoRendererSink::RenderCallback, class VideoFrameCompositorTest : public VideoRendererSink::RenderCallback,
public ::testing::TestWithParam<bool> { public testing::Test {
public: public:
VideoFrameCompositorTest() VideoFrameCompositorTest()
: client_(new StrictMock<MockWebVideoFrameSubmitter>()) {} : client_(new StrictMock<MockWebVideoFrameSubmitter>()) {}
void SetUp() override { void SetUp() override {
if (IsSurfaceLayerForVideoEnabled()) {
// TODO(http://crbug/1134146): Clean up the tests in this file since the
// feature UseSurfaceLayerForVideo no longer exists.
feature_list_.InitFromCommandLine("UseSurfaceLayerForVideo", "");
// When SurfaceLayerForVideo is enabled, |compositor_| owns the
// |submitter_|. Otherwise, the |compositor_| treats the |submitter_| as
// if it were a VideoFrameProviderClient in the VideoLayer code path,
// holding only a bare pointer.
}
submitter_ = client_.get(); submitter_ = client_.get();
if (!IsSurfaceLayerForVideoEnabled()) { EXPECT_CALL(*submitter_, Initialize(_, _));
compositor_ = std::make_unique<VideoFrameCompositor>( compositor_ = std::make_unique<VideoFrameCompositor>(
base::ThreadTaskRunnerHandle::Get(), nullptr); base::ThreadTaskRunnerHandle::Get(), std::move(client_));
compositor_->SetVideoFrameProviderClient(client_.get()); base::RunLoop().RunUntilIdle();
} else { EXPECT_CALL(*submitter_,
EXPECT_CALL(*submitter_, Initialize(_, _)); SetRotation(Eq(media::VideoRotation::VIDEO_ROTATION_90)));
compositor_ = std::make_unique<VideoFrameCompositor>( EXPECT_CALL(*submitter_, SetForceSubmit(false));
base::ThreadTaskRunnerHandle::Get(), std::move(client_)); EXPECT_CALL(*submitter_, EnableSubmission(Eq(viz::SurfaceId())));
base::RunLoop().RunUntilIdle(); compositor_->EnableSubmission(
EXPECT_CALL(*submitter_, viz::SurfaceId(), media::VideoRotation::VIDEO_ROTATION_90, false);
SetRotation(Eq(media::VideoRotation::VIDEO_ROTATION_90)));
EXPECT_CALL(*submitter_, SetForceSubmit(false));
EXPECT_CALL(*submitter_, EnableSubmission(Eq(viz::SurfaceId())));
compositor_->EnableSubmission(
viz::SurfaceId(), media::VideoRotation::VIDEO_ROTATION_90, false);
}
compositor_->set_tick_clock_for_testing(&tick_clock_); compositor_->set_tick_clock_for_testing(&tick_clock_);
// Disable background rendering by default. // Disable background rendering by default.
...@@ -111,8 +94,6 @@ class VideoFrameCompositorTest : public VideoRendererSink::RenderCallback, ...@@ -111,8 +94,6 @@ class VideoFrameCompositorTest : public VideoRendererSink::RenderCallback,
} }
protected: protected:
bool IsSurfaceLayerForVideoEnabled() { return GetParam(); }
// VideoRendererSink::RenderCallback implementation. // VideoRendererSink::RenderCallback implementation.
MOCK_METHOD3(Render, MOCK_METHOD3(Render,
scoped_refptr<VideoFrame>(base::TimeTicks, scoped_refptr<VideoFrame>(base::TimeTicks,
...@@ -156,19 +137,14 @@ class VideoFrameCompositorTest : public VideoRendererSink::RenderCallback, ...@@ -156,19 +137,14 @@ class VideoFrameCompositorTest : public VideoRendererSink::RenderCallback,
std::unique_ptr<VideoFrameCompositor> compositor_; std::unique_ptr<VideoFrameCompositor> compositor_;
private: private:
base::test::ScopedFeatureList feature_list_;
DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositorTest); DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositorTest);
}; };
TEST_P(VideoFrameCompositorTest, InitialValues) { TEST_F(VideoFrameCompositorTest, InitialValues) {
EXPECT_FALSE(compositor()->GetCurrentFrame().get()); EXPECT_FALSE(compositor()->GetCurrentFrame().get());
} }
TEST_P(VideoFrameCompositorTest, SetIsSurfaceVisible) { TEST_F(VideoFrameCompositorTest, SetIsSurfaceVisible) {
if (!IsSurfaceLayerForVideoEnabled())
return;
auto cb = compositor()->GetUpdateSubmissionStateCallback(); auto cb = compositor()->GetUpdateSubmissionStateCallback();
EXPECT_CALL(*submitter_, SetIsSurfaceVisible(true)); EXPECT_CALL(*submitter_, SetIsSurfaceVisible(true));
...@@ -180,10 +156,7 @@ TEST_P(VideoFrameCompositorTest, SetIsSurfaceVisible) { ...@@ -180,10 +156,7 @@ TEST_P(VideoFrameCompositorTest, SetIsSurfaceVisible) {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
} }
TEST_P(VideoFrameCompositorTest, SetIsPageVisible) { TEST_F(VideoFrameCompositorTest, SetIsPageVisible) {
if (!IsSurfaceLayerForVideoEnabled())
return;
EXPECT_CALL(*submitter_, SetIsPageVisible(true)); EXPECT_CALL(*submitter_, SetIsPageVisible(true));
compositor()->SetIsPageVisible(true); compositor()->SetIsPageVisible(true);
...@@ -191,7 +164,7 @@ TEST_P(VideoFrameCompositorTest, SetIsPageVisible) { ...@@ -191,7 +164,7 @@ TEST_P(VideoFrameCompositorTest, SetIsPageVisible) {
compositor()->SetIsPageVisible(false); compositor()->SetIsPageVisible(false);
} }
TEST_P(VideoFrameCompositorTest, PaintSingleFrame) { TEST_F(VideoFrameCompositorTest, PaintSingleFrame) {
scoped_refptr<VideoFrame> expected = VideoFrame::CreateEOSFrame(); scoped_refptr<VideoFrame> expected = VideoFrame::CreateEOSFrame();
// Should notify compositor synchronously. // Should notify compositor synchronously.
...@@ -202,7 +175,7 @@ TEST_P(VideoFrameCompositorTest, PaintSingleFrame) { ...@@ -202,7 +175,7 @@ TEST_P(VideoFrameCompositorTest, PaintSingleFrame) {
EXPECT_EQ(1, submitter_->did_receive_frame_count()); EXPECT_EQ(1, submitter_->did_receive_frame_count());
} }
TEST_P(VideoFrameCompositorTest, RenderFiresPresentationCallback) { TEST_F(VideoFrameCompositorTest, RenderFiresPresentationCallback) {
// Advance the clock so we can differentiate between base::TimeTicks::Now() // Advance the clock so we can differentiate between base::TimeTicks::Now()
// and base::TimeTicks(). // and base::TimeTicks().
tick_clock_.Advance(base::TimeDelta::FromSeconds(1)); tick_clock_.Advance(base::TimeDelta::FromSeconds(1));
...@@ -220,10 +193,7 @@ TEST_P(VideoFrameCompositorTest, RenderFiresPresentationCallback) { ...@@ -220,10 +193,7 @@ TEST_P(VideoFrameCompositorTest, RenderFiresPresentationCallback) {
EXPECT_NE(base::TimeTicks(), metadata->expected_display_time); EXPECT_NE(base::TimeTicks(), metadata->expected_display_time);
} }
TEST_P(VideoFrameCompositorTest, PresentationCallbackForcesBeginFrames) { TEST_F(VideoFrameCompositorTest, PresentationCallbackForcesBeginFrames) {
if (!IsSurfaceLayerForVideoEnabled())
return;
// A call to the requestVideoFrameCallback() API should set ForceBeginFrames. // A call to the requestVideoFrameCallback() API should set ForceBeginFrames.
EXPECT_CALL(*submitter_, SetForceBeginFrames(true)); EXPECT_CALL(*submitter_, SetForceBeginFrames(true));
compositor()->SetOnFramePresentedCallback(GetNewFramePresentedCB()); compositor()->SetOnFramePresentedCallback(GetNewFramePresentedCB());
...@@ -240,7 +210,7 @@ TEST_P(VideoFrameCompositorTest, PresentationCallbackForcesBeginFrames) { ...@@ -240,7 +210,7 @@ TEST_P(VideoFrameCompositorTest, PresentationCallbackForcesBeginFrames) {
testing::Mock::VerifyAndClear(submitter_); testing::Mock::VerifyAndClear(submitter_);
} }
TEST_P(VideoFrameCompositorTest, MultiplePresentationCallbacks) { TEST_F(VideoFrameCompositorTest, MultiplePresentationCallbacks) {
// Advance the clock so we can differentiate between base::TimeTicks::Now() // Advance the clock so we can differentiate between base::TimeTicks::Now()
// and base::TimeTicks(). // and base::TimeTicks().
tick_clock_.Advance(base::TimeDelta::FromSeconds(1)); tick_clock_.Advance(base::TimeDelta::FromSeconds(1));
...@@ -281,7 +251,7 @@ TEST_P(VideoFrameCompositorTest, MultiplePresentationCallbacks) { ...@@ -281,7 +251,7 @@ TEST_P(VideoFrameCompositorTest, MultiplePresentationCallbacks) {
EXPECT_EQ(metadata->width, kSize3); EXPECT_EQ(metadata->width, kSize3);
} }
TEST_P(VideoFrameCompositorTest, VideoRendererSinkFrameDropped) { TEST_F(VideoFrameCompositorTest, VideoRendererSinkFrameDropped) {
scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame(); scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame();
EXPECT_CALL(*this, Render(_, _, _)).WillRepeatedly(Return(opaque_frame)); EXPECT_CALL(*this, Render(_, _, _)).WillRepeatedly(Return(opaque_frame));
...@@ -315,23 +285,14 @@ TEST_P(VideoFrameCompositorTest, VideoRendererSinkFrameDropped) { ...@@ -315,23 +285,14 @@ TEST_P(VideoFrameCompositorTest, VideoRendererSinkFrameDropped) {
StopVideoRendererSink(true); StopVideoRendererSink(true);
} }
TEST_P(VideoFrameCompositorTest, VideoLayerShutdownWhileRendering) { TEST_F(VideoFrameCompositorTest, StartFiresBackgroundRender) {
if (!IsSurfaceLayerForVideoEnabled()) {
EXPECT_CALL(*this, Render(_, _, true)).WillOnce(Return(nullptr));
StartVideoRendererSink();
compositor_->SetVideoFrameProviderClient(nullptr);
StopVideoRendererSink(false);
}
}
TEST_P(VideoFrameCompositorTest, StartFiresBackgroundRender) {
scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame(); scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame();
EXPECT_CALL(*this, Render(_, _, true)).WillRepeatedly(Return(opaque_frame)); EXPECT_CALL(*this, Render(_, _, true)).WillRepeatedly(Return(opaque_frame));
StartVideoRendererSink(); StartVideoRendererSink();
StopVideoRendererSink(true); StopVideoRendererSink(true);
} }
TEST_P(VideoFrameCompositorTest, BackgroundRenderTicks) { TEST_F(VideoFrameCompositorTest, BackgroundRenderTicks) {
scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame(); scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame();
compositor_->set_background_rendering_for_testing(true); compositor_->set_background_rendering_for_testing(true);
...@@ -352,7 +313,7 @@ TEST_P(VideoFrameCompositorTest, BackgroundRenderTicks) { ...@@ -352,7 +313,7 @@ TEST_P(VideoFrameCompositorTest, BackgroundRenderTicks) {
StopVideoRendererSink(true); StopVideoRendererSink(true);
} }
TEST_P(VideoFrameCompositorTest, TEST_F(VideoFrameCompositorTest,
UpdateCurrentFrameWorksWhenBackgroundRendered) { UpdateCurrentFrameWorksWhenBackgroundRendered) {
scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame(); scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame();
compositor_->set_background_rendering_for_testing(true); compositor_->set_background_rendering_for_testing(true);
...@@ -380,7 +341,7 @@ TEST_P(VideoFrameCompositorTest, ...@@ -380,7 +341,7 @@ TEST_P(VideoFrameCompositorTest,
StopVideoRendererSink(true); StopVideoRendererSink(true);
} }
TEST_P(VideoFrameCompositorTest, UpdateCurrentFrameIfStale) { TEST_F(VideoFrameCompositorTest, UpdateCurrentFrameIfStale) {
scoped_refptr<VideoFrame> opaque_frame_1 = CreateOpaqueFrame(); scoped_refptr<VideoFrame> opaque_frame_1 = CreateOpaqueFrame();
scoped_refptr<VideoFrame> opaque_frame_2 = CreateOpaqueFrame(); scoped_refptr<VideoFrame> opaque_frame_2 = CreateOpaqueFrame();
compositor_->set_background_rendering_for_testing(true); compositor_->set_background_rendering_for_testing(true);
...@@ -439,7 +400,7 @@ TEST_P(VideoFrameCompositorTest, UpdateCurrentFrameIfStale) { ...@@ -439,7 +400,7 @@ TEST_P(VideoFrameCompositorTest, UpdateCurrentFrameIfStale) {
StopVideoRendererSink(false); StopVideoRendererSink(false);
} }
TEST_P(VideoFrameCompositorTest, UpdateCurrentFrameIfStale_ClientBypass) { TEST_F(VideoFrameCompositorTest, UpdateCurrentFrameIfStale_ClientBypass) {
scoped_refptr<VideoFrame> opaque_frame_1 = CreateOpaqueFrame(); scoped_refptr<VideoFrame> opaque_frame_1 = CreateOpaqueFrame();
scoped_refptr<VideoFrame> opaque_frame_2 = CreateOpaqueFrame(); scoped_refptr<VideoFrame> opaque_frame_2 = CreateOpaqueFrame();
compositor_->set_background_rendering_for_testing(true); compositor_->set_background_rendering_for_testing(true);
...@@ -468,7 +429,7 @@ TEST_P(VideoFrameCompositorTest, UpdateCurrentFrameIfStale_ClientBypass) { ...@@ -468,7 +429,7 @@ TEST_P(VideoFrameCompositorTest, UpdateCurrentFrameIfStale_ClientBypass) {
StopVideoRendererSink(true); StopVideoRendererSink(true);
} }
TEST_P(VideoFrameCompositorTest, PreferredRenderInterval) { TEST_F(VideoFrameCompositorTest, PreferredRenderInterval) {
preferred_render_interval_ = base::TimeDelta::FromSeconds(1); preferred_render_interval_ = base::TimeDelta::FromSeconds(1);
compositor_->Start(this); compositor_->Start(this);
EXPECT_EQ(compositor_->GetPreferredRenderInterval(), EXPECT_EQ(compositor_->GetPreferredRenderInterval(),
...@@ -478,8 +439,4 @@ TEST_P(VideoFrameCompositorTest, PreferredRenderInterval) { ...@@ -478,8 +439,4 @@ TEST_P(VideoFrameCompositorTest, PreferredRenderInterval) {
viz::BeginFrameArgs::MinInterval()); viz::BeginFrameArgs::MinInterval());
} }
INSTANTIATE_TEST_SUITE_P(SubmitterEnabled,
VideoFrameCompositorTest,
::testing::Bool());
} // namespace media } // namespace media
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment