Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3299)

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 1018463005: cc: PushProperties on viewport size change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 68a1f587aa68dfaec95c50d9588beda55e2a9ac7..b100756a190a03836631b9a636a85deef80b576d 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -475,6 +475,60 @@ class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedrawRect);
+// After a viewport size change, PushProperties must be called a second time.
+class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest {
+ public:
+ LayerTreeHostTestGpuRasterDeviceSizeChanged()
+ : num_draws_(0), bounds_(400, 50), invalid_rect_(10, 10, 20, 20) {}
+
+ void BeginTest() override {
+ root_layer_ = FakePictureLayer::Create(&client_);
+ root_layer_->SetIsDrawable(true);
+ root_layer_->SetBounds(bounds_);
+ layer_tree_host()->SetRootLayer(root_layer_);
+ layer_tree_host()->SetViewportSize(bounds_);
+ PostSetNeedsCommitToMainThread();
+ }
+
+ void InitializeSettings(LayerTreeSettings* settings) override {
+ settings->gpu_rasterization_enabled = true;
+ settings->gpu_rasterization_forced = true;
+ }
+
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
+ // Perform 2 commits.
+ if (!num_draws_) {
+ PostSetNeedsRedrawRectToMainThread(invalid_rect_);
+ } else {
+ EndTest();
+ }
+ num_draws_++;
+ }
+
+ void DidCommitAndDrawFrame() override {
+ // On the second commit, resize the viewport.
+ if (num_draws_ == 1) {
+ gfx::Size bounds2_(500, 60);
+ layer_tree_host()->SetViewportSize(bounds2_);
+ }
+ }
+
+ void AfterTest() override {
+ EXPECT_EQ(2, num_draws_);
+ EXPECT_EQ(2, root_layer_->push_properties_count());
+ }
+
+ private:
+ int num_draws_;
+ const gfx::Size bounds_;
+ const gfx::Rect invalid_rect_;
+ FakeContentLayerClient client_;
+ scoped_refptr<FakePictureLayer> root_layer_;
+};
+
+MULTI_THREAD_DELEGATING_RENDERER_IMPL_TEST_F(
+ LayerTreeHostTestGpuRasterDeviceSizeChanged);
+
class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
public:
void InitializeSettings(LayerTreeSettings* settings) override {
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698