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

Side by Side Diff: cc/layers/layer_impl_unittest.cc

Issue 139173004: [#3] Pass gfx structs by const ref (gfx::SizeF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT and fixed build error for Android platform! Created 6 years, 11 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/input/page_scale_animation.cc ('k') | cc/output/render_surface_filters.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 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/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "cc/output/filter_operation.h" 7 #include "cc/output/filter_operation.h"
8 #include "cc/output/filter_operations.h" 8 #include "cc/output/filter_operations.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE { 395 virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE {
396 return fixed_offset_; 396 return fixed_offset_;
397 } 397 }
398 virtual bool IsExternalFlingActive() const OVERRIDE { return false; } 398 virtual bool IsExternalFlingActive() const OVERRIDE { return false; }
399 399
400 void set_fixed_offset(gfx::Vector2dF fixed_offset) { 400 void set_fixed_offset(gfx::Vector2dF fixed_offset) {
401 fixed_offset_ = fixed_offset; 401 fixed_offset_ = fixed_offset;
402 } 402 }
403 403
404 virtual void SetTotalPageScaleFactor(float page_scale_factor) OVERRIDE {} 404 virtual void SetTotalPageScaleFactor(float page_scale_factor) OVERRIDE {}
405 virtual void SetScrollableSize(gfx::SizeF scrollable_size) OVERRIDE {} 405 virtual void SetScrollableSize(const gfx::SizeF& scrollable_size) OVERRIDE {}
406 406
407 private: 407 private:
408 gfx::Vector2dF fixed_offset_; 408 gfx::Vector2dF fixed_offset_;
409 }; 409 };
410 410
411 TEST_F(LayerImplScrollTest, ScrollByWithIgnoringDelegate) { 411 TEST_F(LayerImplScrollTest, ScrollByWithIgnoringDelegate) {
412 gfx::Vector2d max_scroll_offset(50, 80); 412 gfx::Vector2d max_scroll_offset(50, 80);
413 gfx::Vector2d scroll_offset(10, 5); 413 gfx::Vector2d scroll_offset(10, 5);
414 layer()->SetMaxScrollOffset(max_scroll_offset); 414 layer()->SetMaxScrollOffset(max_scroll_offset);
415 layer()->SetScrollOffset(scroll_offset); 415 layer()->SetScrollOffset(scroll_offset);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 public: 447 public:
448 virtual void SetMaxScrollOffset(gfx::Vector2dF max_scroll_offset) OVERRIDE {} 448 virtual void SetMaxScrollOffset(gfx::Vector2dF max_scroll_offset) OVERRIDE {}
449 virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) OVERRIDE { 449 virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) OVERRIDE {
450 current_offset_ = new_value; 450 current_offset_ = new_value;
451 } 451 }
452 virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE { 452 virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE {
453 return current_offset_; 453 return current_offset_;
454 } 454 }
455 virtual bool IsExternalFlingActive() const OVERRIDE { return false; } 455 virtual bool IsExternalFlingActive() const OVERRIDE { return false; }
456 virtual void SetTotalPageScaleFactor(float page_scale_factor) OVERRIDE {} 456 virtual void SetTotalPageScaleFactor(float page_scale_factor) OVERRIDE {}
457 virtual void SetScrollableSize(gfx::SizeF scrollable_size) OVERRIDE {} 457 virtual void SetScrollableSize(const gfx::SizeF& scrollable_size) OVERRIDE {}
458 458
459 private: 459 private:
460 gfx::Vector2dF current_offset_; 460 gfx::Vector2dF current_offset_;
461 }; 461 };
462 462
463 TEST_F(LayerImplScrollTest, ScrollByWithAcceptingDelegate) { 463 TEST_F(LayerImplScrollTest, ScrollByWithAcceptingDelegate) {
464 gfx::Vector2d max_scroll_offset(50, 80); 464 gfx::Vector2d max_scroll_offset(50, 80);
465 gfx::Vector2d scroll_offset(10, 5); 465 gfx::Vector2d scroll_offset(10, 5);
466 layer()->SetMaxScrollOffset(max_scroll_offset); 466 layer()->SetMaxScrollOffset(max_scroll_offset);
467 layer()->SetScrollOffset(scroll_offset); 467 layer()->SetScrollOffset(scroll_offset);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 layer()->SetMaxScrollOffset(max_scroll_offset); 577 layer()->SetMaxScrollOffset(max_scroll_offset);
578 layer()->SetScrollOffset(scroll_offset); 578 layer()->SetScrollOffset(scroll_offset);
579 gfx::Vector2dF unscrolled = layer()->ScrollBy(scroll_delta); 579 gfx::Vector2dF unscrolled = layer()->ScrollBy(scroll_delta);
580 580
581 EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 8.5f), unscrolled); 581 EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 8.5f), unscrolled);
582 EXPECT_VECTOR_EQ(gfx::Vector2dF(30.5f, 5), layer()->TotalScrollOffset()); 582 EXPECT_VECTOR_EQ(gfx::Vector2dF(30.5f, 5), layer()->TotalScrollOffset());
583 } 583 }
584 584
585 } // namespace 585 } // namespace
586 } // namespace cc 586 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/page_scale_animation.cc ('k') | cc/output/render_surface_filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698