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

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

Issue 12965007: Fix cpplint errors in cc/(animation|input|layers|trees|test)/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_unittest_delegated.cc ('k') | cc/trees/layer_tree_impl.h » ('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 "cc/layers/content_layer.h" 7 #include "cc/layers/content_layer.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/layers/layer_impl.h" 9 #include "cc/layers/layer_impl.h"
10 #include "cc/test/fake_content_layer_client.h" 10 #include "cc/test/fake_content_layer_client.h"
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 virtual void BeginTest() OVERRIDE { 33 virtual void BeginTest() OVERRIDE {
34 layer_tree_host()->root_layer()->SetScrollable(true); 34 layer_tree_host()->root_layer()->SetScrollable(true);
35 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_); 35 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_);
36 PostSetNeedsCommitToMainThread(); 36 PostSetNeedsCommitToMainThread();
37 } 37 }
38 38
39 virtual void Layout() OVERRIDE { 39 virtual void Layout() OVERRIDE {
40 Layer* root = layer_tree_host()->root_layer(); 40 Layer* root = layer_tree_host()->root_layer();
41 if (!layer_tree_host()->commit_number()) 41 if (!layer_tree_host()->commit_number()) {
42 EXPECT_VECTOR_EQ(initial_scroll_, root->scroll_offset()); 42 EXPECT_VECTOR_EQ(initial_scroll_, root->scroll_offset());
43 else { 43 } else {
44 EXPECT_VECTOR_EQ(initial_scroll_ + scroll_amount_, root->scroll_offset()); 44 EXPECT_VECTOR_EQ(initial_scroll_ + scroll_amount_, root->scroll_offset());
45 45
46 // Pretend like Javascript updated the scroll position itself. 46 // Pretend like Javascript updated the scroll position itself.
47 root->SetScrollOffset(second_scroll_); 47 root->SetScrollOffset(second_scroll_);
48 } 48 }
49 } 49 }
50 50
51 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { 51 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
52 LayerImpl* root = impl->active_tree()->root_layer(); 52 LayerImpl* root = impl->active_tree()->root_layer();
53 EXPECT_VECTOR_EQ(gfx::Vector2d(), root->scroll_delta()); 53 EXPECT_VECTOR_EQ(gfx::Vector2d(), root->scroll_delta());
(...skipping 29 matching lines...) Expand all
83 83
84 private: 84 private:
85 gfx::Vector2d initial_scroll_; 85 gfx::Vector2d initial_scroll_;
86 gfx::Vector2d second_scroll_; 86 gfx::Vector2d second_scroll_;
87 gfx::Vector2d scroll_amount_; 87 gfx::Vector2d scroll_amount_;
88 int num_scrolls_; 88 int num_scrolls_;
89 }; 89 };
90 90
91 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollSimple) 91 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollSimple)
92 92
93 class LayerTreeHostScrollTestScrollMultipleRedraw : 93 class LayerTreeHostScrollTestScrollMultipleRedraw
94 public LayerTreeHostScrollTest { 94 : public LayerTreeHostScrollTest {
95 public: 95 public:
96 LayerTreeHostScrollTestScrollMultipleRedraw() 96 LayerTreeHostScrollTestScrollMultipleRedraw()
97 : initial_scroll_(40, 10), 97 : initial_scroll_(40, 10),
98 scroll_amount_(-3, 17), 98 scroll_amount_(-3, 17),
99 num_scrolls_(0) { 99 num_scrolls_(0) {
100 } 100 }
101 101
102 virtual void BeginTest() OVERRIDE { 102 virtual void BeginTest() OVERRIDE {
103 layer_tree_host()->root_layer()->SetScrollable(true); 103 layer_tree_host()->root_layer()->SetScrollable(true);
104 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_); 104 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 227 }
228 228
229 virtual void AfterTest() OVERRIDE {} 229 virtual void AfterTest() OVERRIDE {}
230 230
231 private: 231 private:
232 gfx::Vector2dF scroll_amount_; 232 gfx::Vector2dF scroll_amount_;
233 }; 233 };
234 234
235 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestFractionalScroll) 235 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestFractionalScroll)
236 236
237 class LayerTreeHostScrollTestCaseWithChild : 237 class LayerTreeHostScrollTestCaseWithChild
238 public LayerTreeHostScrollTest, 238 : public LayerTreeHostScrollTest,
239 public WebKit::WebLayerScrollClient { 239 public WebKit::WebLayerScrollClient {
240 public: 240 public:
241 LayerTreeHostScrollTestCaseWithChild() 241 LayerTreeHostScrollTestCaseWithChild()
242 : initial_offset_(10, 20), 242 : initial_offset_(10, 20),
243 javascript_scroll_(40, 5), 243 javascript_scroll_(40, 5),
244 scroll_amount_(2, -1), 244 scroll_amount_(2, -1),
245 num_scrolls_(0) { 245 num_scrolls_(0) {
246 } 246 }
247 247
248 virtual void SetupTree() OVERRIDE { 248 virtual void SetupTree() OVERRIDE {
249 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_); 249 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_);
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 512 }
513 513
514 virtual void BeginTest() OVERRIDE { 514 virtual void BeginTest() OVERRIDE {
515 layer_tree_host()->root_layer()->SetScrollable(true); 515 layer_tree_host()->root_layer()->SetScrollable(true);
516 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_); 516 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_);
517 PostSetNeedsCommitToMainThread(); 517 PostSetNeedsCommitToMainThread();
518 } 518 }
519 519
520 virtual void Layout() OVERRIDE { 520 virtual void Layout() OVERRIDE {
521 Layer* root = layer_tree_host()->root_layer(); 521 Layer* root = layer_tree_host()->root_layer();
522 if (!layer_tree_host()->commit_number()) 522 if (!layer_tree_host()->commit_number()) {
523 EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_); 523 EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_);
524 else { 524 } else {
525 EXPECT_VECTOR_EQ(root->scroll_offset(), 525 EXPECT_VECTOR_EQ(root->scroll_offset(),
526 initial_scroll_ + impl_thread_scroll1_); 526 initial_scroll_ + impl_thread_scroll1_);
527 527
528 // Pretend like Javascript updated the scroll position itself with a 528 // Pretend like Javascript updated the scroll position itself with a
529 // change of main_thread_scroll. 529 // change of main_thread_scroll.
530 root->SetScrollOffset(initial_scroll_ + 530 root->SetScrollOffset(initial_scroll_ +
531 main_thread_scroll_ + 531 main_thread_scroll_ +
532 impl_thread_scroll1_); 532 impl_thread_scroll1_);
533 } 533 }
534 } 534 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 EndTest(); 655 EndTest();
656 } 656 }
657 657
658 virtual void AfterTest() OVERRIDE {} 658 virtual void AfterTest() OVERRIDE {}
659 }; 659 };
660 660
661 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollZeroMaxScrollOffset) 661 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollZeroMaxScrollOffset)
662 662
663 } // namespace 663 } // namespace
664 } // namespace cc 664 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_delegated.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698