Chromium Code Reviews| Index: cc/trees/layer_tree_host_unittest_context.cc |
| diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc |
| index 8fcfa28a10f1067557ae51fe21fdc4abfc20ae24..e081b9603e9c5f531549e8520c488e5159735d67 100644 |
| --- a/cc/trees/layer_tree_host_unittest_context.cc |
| +++ b/cc/trees/layer_tree_host_unittest_context.cc |
| @@ -27,6 +27,8 @@ |
| #include "cc/test/fake_output_surface.h" |
| #include "cc/test/fake_output_surface_client.h" |
| #include "cc/test/fake_painted_scrollbar_layer.h" |
| +#include "cc/test/fake_picture_layer.h" |
| +#include "cc/test/fake_picture_layer_impl.h" |
| #include "cc/test/fake_scoped_ui_resource.h" |
| #include "cc/test/fake_scrollbar.h" |
| #include "cc/test/fake_video_frame_provider.h" |
| @@ -322,11 +324,22 @@ class LayerTreeHostContextTestLostContextSucceedsWithContent |
| root_->SetBounds(gfx::Size(10, 10)); |
| root_->SetIsDrawable(true); |
| - content_ = FakeContentLayer::Create(&client_); |
| - content_->SetBounds(gfx::Size(10, 10)); |
| - content_->SetIsDrawable(true); |
| + // Paint non-solid color. |
| + SkPaint paint; |
| + paint.setColor(SkColorSetARGB(100, 80, 200, 200)); |
| + client_.add_draw_rect(gfx::Rect(0, 0, 5, 5), paint); |
| + client_.add_draw_rect(gfx::Rect(10, 10, 10, 10), paint); |
| + client_.add_draw_rect(gfx::Rect(30, 30, 5, 5), paint); |
| + client_.add_draw_rect(gfx::Rect(50, 50, 5, 5), paint); |
|
sohanjg
2014/09/08 15:17:32
Are we drawing/recording this too far away from vi
|
| - root_->AddChild(content_); |
| + if (layer_tree_host()->settings().impl_side_painting) |
| + layer_ = FakePictureLayer::Create(&client_); |
| + else |
| + layer_ = FakeContentLayer::Create(&client_); |
| + layer_->SetBounds(gfx::Size(10, 10)); |
| + layer_->SetIsDrawable(true); |
| + |
| + root_->AddChild(layer_); |
| layer_tree_host()->SetRootLayer(root_); |
| LayerTreeHostContextTest::SetupTree(); |
| @@ -336,27 +349,33 @@ class LayerTreeHostContextTestLostContextSucceedsWithContent |
| // Invalidate the render surface so we don't try to use a cached copy of the |
| // surface. We want to make sure to test the drawing paths for drawing to |
| // a child surface. |
| - content_->SetNeedsDisplay(); |
| + layer_->SetNeedsDisplay(); |
| LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); |
| } |
| virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| - FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( |
| - host_impl->active_tree()->root_layer()->children()[0]); |
| - // Even though the context was lost, we should have a resource. The |
| - // TestWebGraphicsContext3D ensures that this resource is created with |
| - // the active context. |
| - EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); |
| + if (!layer_tree_host()->settings().impl_side_painting) { |
| + FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( |
| + host_impl->active_tree()->root_layer()->children()[0]); |
| + // Even though the context was lost, we should have a resource. The |
| + // TestWebGraphicsContext3D ensures that this resource is created with |
| + // the active context. |
| + EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); |
| + } else { |
| + FakePictureLayerImpl* picture_impl = static_cast<FakePictureLayerImpl*>( |
| + host_impl->active_tree()->root_layer()->children()[0]); |
| + EXPECT_TRUE(picture_impl->HighResTiling()->TileAt(0, 0)->IsReadyToDraw()); |
| + } |
| } |
| protected: |
| FakeContentLayerClient client_; |
| scoped_refptr<Layer> root_; |
| - scoped_refptr<ContentLayer> content_; |
| + scoped_refptr<Layer> layer_; |
| }; |
| -// This test uses TiledLayer to check for a working context. |
| -SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F( |
| +// This test uses TiledLayer and PictureLayer to check for a working context. |
| +SINGLE_AND_MULTI_THREAD_TEST_F( |
| LayerTreeHostContextTestLostContextSucceedsWithContent); |
| class LayerTreeHostContextTestCreateOutputSurfaceFails |