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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 642113004: cc: Damage layer on delegated scroll (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after
3455 DrawFrame(); 3455 DrawFrame();
3456 CheckLayerScrollDelta(scroll_layer, gfx::Vector2dF(0.f, 0.f)); 3456 CheckLayerScrollDelta(scroll_layer, gfx::Vector2dF(0.f, 0.f));
3457 EXPECT_FALSE(host_impl_->active_tree()->needs_update_draw_properties()); 3457 EXPECT_FALSE(host_impl_->active_tree()->needs_update_draw_properties());
3458 3458
3459 // Set external scroll delta on delegate and notify LayerTreeHost. 3459 // Set external scroll delta on delegate and notify LayerTreeHost.
3460 gfx::ScrollOffset scroll_offset(10.f, 10.f); 3460 gfx::ScrollOffset scroll_offset(10.f, 10.f);
3461 scroll_delegate.set_getter_return_value(scroll_offset); 3461 scroll_delegate.set_getter_return_value(scroll_offset);
3462 host_impl_->OnRootLayerDelegatedScrollOffsetChanged(); 3462 host_impl_->OnRootLayerDelegatedScrollOffsetChanged();
3463 3463
3464 // Check scroll delta reflected in layer. 3464 // Check scroll delta reflected in layer.
3465 DrawFrame(); 3465 LayerTreeHostImpl::FrameData frame;
3466 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
3467 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
3468 host_impl_->DidDrawAllLayers(frame);
3469 EXPECT_FALSE(frame.has_no_damage);
3466 CheckLayerScrollDelta(scroll_layer, ScrollOffsetToVector2dF(scroll_offset)); 3470 CheckLayerScrollDelta(scroll_layer, ScrollOffsetToVector2dF(scroll_offset));
3467 3471
3468 host_impl_->SetRootLayerScrollOffsetDelegate(NULL); 3472 host_impl_->SetRootLayerScrollOffsetDelegate(NULL);
3469 } 3473 }
3470 3474
3471 TEST_F(LayerTreeHostImplTest, OverscrollRoot) { 3475 TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
3472 SetupScrollAndContentsLayers(gfx::Size(100, 100)); 3476 SetupScrollAndContentsLayers(gfx::Size(100, 100));
3473 host_impl_->SetViewportSize(gfx::Size(50, 50)); 3477 host_impl_->SetViewportSize(gfx::Size(50, 50));
3474 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, 0.5f, 4.f); 3478 host_impl_->active_tree()->SetPageScaleFactorAndLimits(1.f, 0.5f, 4.f);
3475 DrawFrame(); 3479 DrawFrame();
(...skipping 3791 matching lines...) Expand 10 before | Expand all | Expand 10 after
7267 // surface. 7271 // surface.
7268 EXPECT_EQ(0, num_lost_surfaces_); 7272 EXPECT_EQ(0, num_lost_surfaces_);
7269 host_impl_->DidLoseOutputSurface(); 7273 host_impl_->DidLoseOutputSurface();
7270 EXPECT_EQ(1, num_lost_surfaces_); 7274 EXPECT_EQ(1, num_lost_surfaces_);
7271 host_impl_->DidLoseOutputSurface(); 7275 host_impl_->DidLoseOutputSurface();
7272 EXPECT_LE(1, num_lost_surfaces_); 7276 EXPECT_LE(1, num_lost_surfaces_);
7273 } 7277 }
7274 7278
7275 } // namespace 7279 } // namespace
7276 } // namespace cc 7280 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698