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

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

Issue 681713002: Update from chromium https://crrev.com/301315 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/layers/layer_impl.cc ('k') | cc/layers/picture_layer.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 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/layers/painted_scrollbar_layer_impl.h" 7 #include "cc/layers/painted_scrollbar_layer_impl.h"
8 #include "cc/output/filter_operation.h" 8 #include "cc/output/filter_operation.h"
9 #include "cc/output/filter_operations.h" 9 #include "cc/output/filter_operations.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); 495 EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset());
496 } 496 }
497 497
498 class ScrollDelegateIgnore : public LayerImpl::ScrollOffsetDelegate { 498 class ScrollDelegateIgnore : public LayerImpl::ScrollOffsetDelegate {
499 public: 499 public:
500 void SetTotalScrollOffset(const gfx::ScrollOffset& new_value) override {} 500 void SetTotalScrollOffset(const gfx::ScrollOffset& new_value) override {}
501 gfx::ScrollOffset GetTotalScrollOffset() override { 501 gfx::ScrollOffset GetTotalScrollOffset() override {
502 return gfx::ScrollOffset(fixed_offset_); 502 return gfx::ScrollOffset(fixed_offset_);
503 } 503 }
504 bool IsExternalFlingActive() const override { return false; } 504 bool IsExternalFlingActive() const override { return false; }
505 void Update() const override { }
505 506
506 void set_fixed_offset(const gfx::Vector2dF& fixed_offset) { 507 void set_fixed_offset(const gfx::Vector2dF& fixed_offset) {
507 fixed_offset_ = fixed_offset; 508 fixed_offset_ = fixed_offset;
508 } 509 }
509 510
510 private: 511 private:
511 gfx::Vector2dF fixed_offset_; 512 gfx::Vector2dF fixed_offset_;
512 }; 513 };
513 514
514 TEST_F(LayerImplScrollTest, ScrollByWithIgnoringDelegate) { 515 TEST_F(LayerImplScrollTest, ScrollByWithIgnoringDelegate) {
(...skipping 29 matching lines...) Expand all
544 EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); 545 EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset());
545 } 546 }
546 547
547 class ScrollDelegateAccept : public LayerImpl::ScrollOffsetDelegate { 548 class ScrollDelegateAccept : public LayerImpl::ScrollOffsetDelegate {
548 public: 549 public:
549 void SetTotalScrollOffset(const gfx::ScrollOffset& new_value) override { 550 void SetTotalScrollOffset(const gfx::ScrollOffset& new_value) override {
550 current_offset_ = new_value; 551 current_offset_ = new_value;
551 } 552 }
552 gfx::ScrollOffset GetTotalScrollOffset() override { return current_offset_; } 553 gfx::ScrollOffset GetTotalScrollOffset() override { return current_offset_; }
553 bool IsExternalFlingActive() const override { return false; } 554 bool IsExternalFlingActive() const override { return false; }
555 void Update() const override { }
554 556
555 private: 557 private:
556 gfx::ScrollOffset current_offset_; 558 gfx::ScrollOffset current_offset_;
557 }; 559 };
558 560
559 TEST_F(LayerImplScrollTest, ScrollByWithAcceptingDelegate) { 561 TEST_F(LayerImplScrollTest, ScrollByWithAcceptingDelegate) {
560 gfx::ScrollOffset scroll_offset(10, 5); 562 gfx::ScrollOffset scroll_offset(10, 5);
561 layer()->SetScrollOffset(scroll_offset); 563 layer()->SetScrollOffset(scroll_offset);
562 564
563 EXPECT_VECTOR_EQ(scroll_offset, layer()->TotalScrollOffset()); 565 EXPECT_VECTOR_EQ(scroll_offset, layer()->TotalScrollOffset());
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 layer()->id(), tree()->root_layer()->id()); 695 layer()->id(), tree()->root_layer()->id());
694 696
695 int expected_horizontal_maximum = 697 int expected_horizontal_maximum =
696 layer()->bounds().width() - tree()->root_layer()->bounds().width(); 698 layer()->bounds().width() - tree()->root_layer()->bounds().width();
697 EXPECT_EQ(expected_horizontal_maximum, horizontal_scrollbar->maximum()); 699 EXPECT_EQ(expected_horizontal_maximum, horizontal_scrollbar->maximum());
698 EXPECT_EQ(scroll_offset.x(), horizontal_scrollbar->current_pos()); 700 EXPECT_EQ(scroll_offset.x(), horizontal_scrollbar->current_pos());
699 } 701 }
700 702
701 } // namespace 703 } // namespace
702 } // namespace cc 704 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/picture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698