summaryrefslogtreecommitdiffstats
path: root/cc/trees/layer_tree_host_unittest_picture.cc
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2014-12-10 15:19:51 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-10 23:20:16 +0000
commitf70c1d3366c0f3f037fbcad998e3b05d90677073 (patch)
tree533fd2e0a999617f696b9df41cbe9dc6e210446d /cc/trees/layer_tree_host_unittest_picture.cc
parentcecf6e14ec375cb66e2816d67a574270dbc7705b (diff)
downloadchromium_src-f70c1d3366c0f3f037fbcad998e3b05d90677073.zip
chromium_src-f70c1d3366c0f3f037fbcad998e3b05d90677073.tar.gz
chromium_src-f70c1d3366c0f3f037fbcad998e3b05d90677073.tar.bz2
cc: Push layer properties after tree/host properties during commit.
PictureLayer push properties will update tilings and maybe cause it to choose a new tile size. If the viewport size is not pushed at that time, it will choose the wrong tile size with GPU rasterization (where tile sizes are based on the viewport size). This test passes before/after this patch, but will fail with the don't-swap-tilings patch without the changes in this CL. BUG=387116 Review URL: https://codereview.chromium.org/796473002 Cr-Commit-Position: refs/heads/master@{#307786}
Diffstat (limited to 'cc/trees/layer_tree_host_unittest_picture.cc')
-rw-r--r--cc/trees/layer_tree_host_unittest_picture.cc64
1 files changed, 64 insertions, 0 deletions
diff --git a/cc/trees/layer_tree_host_unittest_picture.cc b/cc/trees/layer_tree_host_unittest_picture.cc
index 2d485b4..c82eb76 100644
--- a/cc/trees/layer_tree_host_unittest_picture.cc
+++ b/cc/trees/layer_tree_host_unittest_picture.cc
@@ -123,5 +123,69 @@ class LayerTreeHostPictureTestTwinLayer
MULTI_THREAD_TEST_F(LayerTreeHostPictureTestTwinLayer);
+class LayerTreeHostPictureTestResizeViewportWithGpuRaster
+ : public LayerTreeHostPictureTest {
+ void InitializeSettings(LayerTreeSettings* settings) override {
+ settings->gpu_rasterization_forced = true;
+ }
+
+ void SetupTree() override {
+ scoped_refptr<Layer> root = Layer::Create();
+ root->SetBounds(gfx::Size(768, 960));
+
+ client_.set_fill_with_nonsolid_color(true);
+ picture_ = FakePictureLayer::Create(&client_);
+ picture_->SetBounds(gfx::Size(768, 960));
+ root->AddChild(picture_);
+
+ layer_tree_host()->SetRootLayer(root);
+ LayerTreeHostPictureTest::SetupTree();
+ }
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override {
+ LayerImpl* child = impl->sync_tree()->root_layer()->children()[0];
+ FakePictureLayerImpl* picture_impl =
+ static_cast<FakePictureLayerImpl*>(child);
+ gfx::Size tile_size =
+ picture_impl->HighResTiling()->TileAt(0, 0)->content_rect().size();
+
+ switch (impl->sync_tree()->source_frame_number()) {
+ case 0:
+ tile_size_ = tile_size;
+ // GPU Raster picks a tile size based on the viewport size.
+ EXPECT_EQ(gfx::Size(768, 256), tile_size);
+ break;
+ case 1:
+ // When the viewport changed size, the new frame's tiles should change
+ // along with it.
+ EXPECT_NE(gfx::Size(768, 256), tile_size);
+ }
+ }
+
+ void DidCommit() override {
+ switch (layer_tree_host()->source_frame_number()) {
+ case 1:
+ // Change the picture layer's size along with the viewport, so it will
+ // consider picking a new tile size.
+ picture_->SetBounds(gfx::Size(768, 1056));
+ layer_tree_host()->SetViewportSize(gfx::Size(768, 1056));
+ break;
+ case 2:
+ EndTest();
+ }
+ }
+
+ void AfterTest() override {}
+
+ gfx::Size tile_size_;
+ FakeContentLayerClient client_;
+ scoped_refptr<FakePictureLayer> picture_;
+};
+
+SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(
+ LayerTreeHostPictureTestResizeViewportWithGpuRaster);
+
} // namespace
} // namespace cc