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

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

Issue 1646663002: Refactor Scroll Customization to share cc::ScrollStateData with blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linking. Created 4 years, 10 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
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 12 matching lines...) Expand all
23 #include "cc/test/test_task_graph_runner.h" 23 #include "cc/test/test_task_graph_runner.h"
24 #include "cc/trees/layer_tree_impl.h" 24 #include "cc/trees/layer_tree_impl.h"
25 #include "ui/gfx/geometry/point_conversions.h" 25 #include "ui/gfx/geometry/point_conversions.h"
26 #include "ui/gfx/geometry/size_conversions.h" 26 #include "ui/gfx/geometry/size_conversions.h"
27 #include "ui/gfx/geometry/vector2d_conversions.h" 27 #include "ui/gfx/geometry/vector2d_conversions.h"
28 28
29 namespace cc { 29 namespace cc {
30 namespace { 30 namespace {
31 31
32 scoped_ptr<ScrollState> BeginState(const gfx::Point& point) { 32 scoped_ptr<ScrollState> BeginState(const gfx::Point& point) {
33 return ScrollState::Create(gfx::Vector2dF(), point, gfx::Vector2dF(), true, 33 ScrollStateData scroll_state_data;
34 false, false); 34 scroll_state_data.is_beginning = true;
35 scroll_state_data.start_position_x = point.x();
36 scroll_state_data.start_position_y = point.y();
37 scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data));
38 return scroll_state;
35 } 39 }
36 40
37 scoped_ptr<ScrollState> UpdateState(const gfx::Point& point, 41 scoped_ptr<ScrollState> UpdateState(const gfx::Point& point,
38 const gfx::Vector2dF& delta) { 42 const gfx::Vector2dF& delta) {
39 return ScrollState::Create(delta, point, gfx::Vector2dF(), false, false, 43 ScrollStateData scroll_state_data;
40 false); 44 scroll_state_data.delta_x = delta.x();
45 scroll_state_data.delta_y = delta.y();
46 scroll_state_data.start_position_x = point.x();
47 scroll_state_data.start_position_y = point.y();
48 scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data));
49 return scroll_state;
41 } 50 }
42 51
43 scoped_ptr<ScrollState> EndState() { 52 scoped_ptr<ScrollState> EndState() {
44 return ScrollState::Create(gfx::Vector2dF(), gfx::Point(), gfx::Vector2dF(), 53 ScrollStateData scroll_state_data;
45 false, false, true); 54 scroll_state_data.is_ending = true;
55 scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data));
56 return scroll_state;
46 } 57 }
47 58
48 class LayerTreeHostScrollTest : public LayerTreeTest { 59 class LayerTreeHostScrollTest : public LayerTreeTest {
49 protected: 60 protected:
50 void SetupTree() override { 61 void SetupTree() override {
51 LayerTreeTest::SetupTree(); 62 LayerTreeTest::SetupTree();
52 Layer* root_layer = layer_tree_host()->root_layer(); 63 Layer* root_layer = layer_tree_host()->root_layer();
53 64
54 // Create an effective max_scroll_offset of (100, 100). 65 // Create an effective max_scroll_offset of (100, 100).
55 gfx::Size scroll_layer_bounds(root_layer->bounds().width() + 100, 66 gfx::Size scroll_layer_bounds(root_layer->bounds().width() + 100,
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 RunTest(CompositorMode::THREADED, false); 1347 RunTest(CompositorMode::THREADED, false);
1337 } 1348 }
1338 1349
1339 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { 1350 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) {
1340 scroll_destroy_whole_tree_ = true; 1351 scroll_destroy_whole_tree_ = true;
1341 RunTest(CompositorMode::THREADED, false); 1352 RunTest(CompositorMode::THREADED, false);
1342 } 1353 }
1343 1354
1344 } // namespace 1355 } // namespace
1345 } // namespace cc 1356 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698