| OLD | NEW |
| 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.h" |
| 10 #include "cc/test/fake_content_layer_client.h" | 11 #include "cc/test/fake_content_layer_client.h" |
| 11 #include "cc/test/geometry_test_utils.h" | 12 #include "cc/test/geometry_test_utils.h" |
| 12 #include "cc/test/layer_tree_test.h" | 13 #include "cc/test/layer_tree_test.h" |
| 13 #include "cc/trees/layer_tree_impl.h" | 14 #include "cc/trees/layer_tree_impl.h" |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerScrollClien
t.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerScrollClien
t.h" |
| 15 #include "ui/gfx/point_conversions.h" | 16 #include "ui/gfx/point_conversions.h" |
| 16 #include "ui/gfx/size_conversions.h" | 17 #include "ui/gfx/size_conversions.h" |
| 17 #include "ui/gfx/vector2d_conversions.h" | 18 #include "ui/gfx/vector2d_conversions.h" |
| 18 | 19 |
| 19 namespace cc { | 20 namespace cc { |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 | 655 |
| 655 EndTest(); | 656 EndTest(); |
| 656 } | 657 } |
| 657 | 658 |
| 658 virtual void AfterTest() OVERRIDE {} | 659 virtual void AfterTest() OVERRIDE {} |
| 659 }; | 660 }; |
| 660 | 661 |
| 661 SINGLE_AND_MULTI_THREAD_TEST_F( | 662 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 662 LayerTreeHostScrollTestScrollZeroMaxScrollOffset); | 663 LayerTreeHostScrollTestScrollZeroMaxScrollOffset); |
| 663 | 664 |
| 665 class LayerTreeHostScrollTestScrollUpdateMaxScrollOffset |
| 666 : public LayerTreeHostScrollTest { |
| 667 public: |
| 668 LayerTreeHostScrollTestScrollUpdateMaxScrollOffset() {} |
| 669 |
| 670 virtual void BeginTest() OVERRIDE { |
| 671 PostSetNeedsCommitToMainThread(); |
| 672 } |
| 673 |
| 674 virtual void SetupTree() OVERRIDE { |
| 675 LayerTreeTest::SetupTree(); |
| 676 first_content_layer_ = FakeContentLayer::Create(&client_); |
| 677 first_content_layer_->SetBounds(gfx::Size(1, 256)); |
| 678 first_content_layer_->set_layer_animation_delegate(this); |
| 679 layer_tree_host()->root_layer()->AddChild(first_content_layer_); |
| 680 second_content_layer_ = FakeContentLayer::Create(&client_); |
| 681 second_content_layer_->SetBounds(gfx::Size(256, 1)); |
| 682 second_content_layer_->set_layer_animation_delegate(this); |
| 683 layer_tree_host()->root_layer()->AddChild(second_content_layer_); |
| 684 layer_tree_host()->root_layer()->SetScrollable(true); |
| 685 } |
| 686 |
| 687 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 688 LayerImpl* root = impl->active_tree()->root_layer(); |
| 689 EXPECT_EQ(255, root->max_scroll_offset().x()); |
| 690 EXPECT_EQ(255, root->max_scroll_offset().y()); |
| 691 EndTest(); |
| 692 } |
| 693 |
| 694 virtual void AfterTest() OVERRIDE {} |
| 695 |
| 696 private: |
| 697 FakeContentLayerClient client_; |
| 698 scoped_refptr<FakeContentLayer> first_content_layer_; |
| 699 scoped_refptr<FakeContentLayer> second_content_layer_; |
| 700 }; |
| 701 |
| 702 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 703 LayerTreeHostScrollTestScrollUpdateMaxScrollOffset); |
| 704 |
| 664 } // namespace | 705 } // namespace |
| 665 } // namespace cc | 706 } // namespace cc |
| OLD | NEW |