return TestWebGraphicsContext3D::Create();
}
- virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurfaceForTest(
- bool fallback) OVERRIDE {
+ virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback)
+ OVERRIDE {
if (times_to_fail_create_) {
--times_to_fail_create_;
ExpectCreateToFail();
return offscreen_contexts_;
}
- virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame,
- bool result) OVERRIDE {
- EXPECT_TRUE(result);
+ virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame,
+ DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
if (!times_to_lose_during_draw_)
- return result;
+ return draw_result;
--times_to_lose_during_draw_;
LoseContext();
times_to_fail_create_offscreen_ = times_to_fail_recreate_offscreen_;
times_to_fail_recreate_offscreen_ = 0;
- return result;
+ return draw_result;
}
virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
PostSetNeedsCommitToMainThread();
}
- virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
+ virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback)
OVERRIDE {
- scoped_ptr<OutputSurface> surface =
- LayerTreeHostContextTest::CreateOutputSurface(fallback);
+ scoped_ptr<FakeOutputSurface> surface =
+ LayerTreeHostContextTest::CreateFakeOutputSurface(fallback);
if (surface)
EXPECT_EQ(times_to_fail_, times_create_failed_);
texture->SetAnchorPoint(gfx::PointF());
texture->SetIsDrawable(true);
texture->SetTextureMailbox(
- TextureMailbox(mailbox, sync_point),
+ TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point),
SingleReleaseCallback::Create(
base::Bind(&LayerTreeHostContextTestDontUseLostResources::
EmptyReleaseCallback)));
color_video_frame_ = VideoFrame::CreateColorFrame(
gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta());
- hw_video_frame_ = VideoFrame::WrapNativeTexture(
- make_scoped_ptr(new VideoFrame::MailboxHolder(
- mailbox,
- sync_point,
- VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())),
- GL_TEXTURE_2D,
- gfx::Size(4, 4),
- gfx::Rect(0, 0, 4, 4),
- gfx::Size(4, 4),
- base::TimeDelta(),
- VideoFrame::ReadPixelsCB(),
- base::Closure());
- scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture(
- make_scoped_ptr(new VideoFrame::MailboxHolder(
- mailbox,
- sync_point,
- VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())),
- GL_TEXTURE_2D,
- gfx::Size(4, 4),
- gfx::Rect(0, 0, 3, 2),
- gfx::Size(4, 4),
- base::TimeDelta(),
- VideoFrame::ReadPixelsCB(),
- base::Closure());
+ hw_video_frame_ =
+ VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder(
+ mailbox, GL_TEXTURE_2D, sync_point)),
+ media::VideoFrame::ReleaseMailboxCB(),
+ gfx::Size(4, 4),
+ gfx::Rect(0, 0, 4, 4),
+ gfx::Size(4, 4),
+ base::TimeDelta(),
+ VideoFrame::ReadPixelsCB());
+ scaled_hw_video_frame_ =
+ VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder(
+ mailbox, GL_TEXTURE_2D, sync_point)),
+ media::VideoFrame::ReleaseMailboxCB(),
+ gfx::Size(4, 4),
+ gfx::Rect(0, 0, 3, 2),
+ gfx::Size(4, 4),
+ base::TimeDelta(),
+ VideoFrame::ReadPixelsCB());
color_frame_provider_.set_frame(color_video_frame_);
hw_frame_provider_.set_frame(hw_video_frame_);
}
}
- virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame,
- bool result) OVERRIDE {
+ virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame,
+ DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
if (host_impl->active_tree()->source_frame_number() == 2) {
// Lose the context during draw on the second commit. This will cause
// a third commit to recover.
context3d_->set_times_bind_texture_succeeds(0);
}
- return true;
+ return draw_result;
}
- virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
+ virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback)
OVERRIDE {
// This will get called twice:
// First when we create the initial output surface...
lost_context_ = true;
EXPECT_EQ(layer_tree_host()->source_frame_number(), 3);
}
- return LayerTreeHostContextTest::CreateOutputSurface(fallback);
+ return LayerTreeHostContextTest::CreateFakeOutputSurface(fallback);
}
virtual void DidCommitAndDrawFrame() OVERRIDE {
EXPECT_EQ(1, times_output_surface_created_);
}
- virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame_data,
- bool result) OVERRIDE {
+ virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame_data,
+ DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
EXPECT_GE(host_impl->active_tree()->source_frame_number(), 0);
EXPECT_LE(host_impl->active_tree()->source_frame_number(), 1);
- return true;
+ return draw_result;
}
virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame_data,
- bool result) OVERRIDE {
+ virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame_data,
+ DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
int sfn = host_impl->active_tree()->source_frame_number();
EXPECT_TRUE(sfn == kFirstOutputSurfaceInitSourceFrameNumber ||
sfn == kSecondOutputSurfaceInitSourceFrameNumber ||
LoseContext();
}
- return false;
+ return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
}
virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame_data,
- bool result) OVERRIDE {
+ virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame_data,
+ DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
int sfn = host_impl->active_tree()->source_frame_number();
EXPECT_TRUE(sfn == kFirstOutputSurfaceInitSourceFrameNumber ||
sfn == kSecondOutputSurfaceInitSourceFrameNumber ||
}
// Returning false will result in a forced draw.
- return false;
+ return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
}
virtual void DidInitializeOutputSurface(bool succeeded) OVERRIDE {