| OLD | NEW |
| 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/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/synchronization/lock.h" | 7 #include "base/synchronization/lock.h" |
| 8 #include "cc/content_layer.h" | 8 #include "cc/content_layer.h" |
| 9 #include "cc/content_layer_client.h" | 9 #include "cc/content_layer_client.h" |
| 10 #include "cc/frame_rate_controller.h" | 10 #include "cc/frame_rate_controller.h" |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 m_layerTreeHost->setBackgroundColor(SK_ColorGRAY); | 641 m_layerTreeHost->setBackgroundColor(SK_ColorGRAY); |
| 642 m_layerTreeHost->setPageScaleFactorAndLimits(5, 5, 5); | 642 m_layerTreeHost->setPageScaleFactorAndLimits(5, 5, 5); |
| 643 | 643 |
| 644 postSetNeedsCommitToMainThread(); | 644 postSetNeedsCommitToMainThread(); |
| 645 } | 645 } |
| 646 | 646 |
| 647 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE | 647 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE |
| 648 { | 648 { |
| 649 EXPECT_EQ(gfx::Size(20, 20), impl->layoutViewportSize()); | 649 EXPECT_EQ(gfx::Size(20, 20), impl->layoutViewportSize()); |
| 650 EXPECT_EQ(SK_ColorGRAY, impl->activeTree()->background_color()); | 650 EXPECT_EQ(SK_ColorGRAY, impl->activeTree()->background_color()); |
| 651 EXPECT_EQ(5, impl->pageScaleFactor()); | 651 EXPECT_EQ(5, impl->activeTree()->page_scale_factor()); |
| 652 | 652 |
| 653 endTest(); | 653 endTest(); |
| 654 } | 654 } |
| 655 | 655 |
| 656 virtual void afterTest() OVERRIDE { } | 656 virtual void afterTest() OVERRIDE { } |
| 657 }; | 657 }; |
| 658 | 658 |
| 659 TEST_F(LayerTreeHostTestCommit, runTest) | 659 TEST_F(LayerTreeHostTestCommit, runTest) |
| 660 { | 660 { |
| 661 runTest(true); | 661 runTest(true); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 681 | 681 |
| 682 void requestStartPageScaleAnimation() | 682 void requestStartPageScaleAnimation() |
| 683 { | 683 { |
| 684 layerTreeHost()->startPageScaleAnimation(gfx::Vector2d(), false, 1.25, b
ase::TimeDelta()); | 684 layerTreeHost()->startPageScaleAnimation(gfx::Vector2d(), false, 1.25, b
ase::TimeDelta()); |
| 685 } | 685 } |
| 686 | 686 |
| 687 virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE | 687 virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE |
| 688 { | 688 { |
| 689 impl->rootLayer()->setScrollable(true); | 689 impl->rootLayer()->setScrollable(true); |
| 690 impl->rootLayer()->setScrollOffset(gfx::Vector2d()); | 690 impl->rootLayer()->setScrollOffset(gfx::Vector2d()); |
| 691 impl->setPageScaleFactorAndLimits(impl->pageScaleFactor(), 0.5, 2); | 691 impl->activeTree()->SetPageScaleFactorAndLimits(impl->activeTree()->page
_scale_factor(), 0.5, 2); |
| 692 | 692 |
| 693 // We request animation only once. | 693 // We request animation only once. |
| 694 if (!m_animationRequested) { | 694 if (!m_animationRequested) { |
| 695 impl->proxy()->mainThread()->postTask(base::Bind(&LayerTreeHostTestS
tartPageScaleAnimation::requestStartPageScaleAnimation, base::Unretained(this)))
; | 695 impl->proxy()->mainThread()->postTask(base::Bind(&LayerTreeHostTestS
tartPageScaleAnimation::requestStartPageScaleAnimation, base::Unretained(this)))
; |
| 696 m_animationRequested = true; | 696 m_animationRequested = true; |
| 697 } | 697 } |
| 698 } | 698 } |
| 699 | 699 |
| 700 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVE
RRIDE | 700 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVE
RRIDE |
| 701 { | 701 { |
| 702 gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scrollOffset(); | 702 gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scrollOffset(); |
| 703 m_layerTreeHost->rootLayer()->setScrollOffset(offset + scrollDelta); | 703 m_layerTreeHost->rootLayer()->setScrollOffset(offset + scrollDelta); |
| 704 m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2); | 704 m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2); |
| 705 } | 705 } |
| 706 | 706 |
| 707 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE | 707 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE |
| 708 { | 708 { |
| 709 impl->processScrollDeltas(); | 709 impl->processScrollDeltas(); |
| 710 // We get one commit before the first draw, and the animation doesn't ha
ppen until the second draw. | 710 // We get one commit before the first draw, and the animation doesn't ha
ppen until the second draw. |
| 711 if (impl->activeTree()->source_frame_number() == 1) { | 711 if (impl->activeTree()->source_frame_number() == 1) { |
| 712 EXPECT_EQ(1.25, impl->pageScaleFactor()); | 712 EXPECT_EQ(1.25, impl->activeTree()->page_scale_factor()); |
| 713 endTest(); | 713 endTest(); |
| 714 } else | 714 } else |
| 715 postSetNeedsRedrawToMainThread(); | 715 postSetNeedsRedrawToMainThread(); |
| 716 } | 716 } |
| 717 | 717 |
| 718 virtual void afterTest() OVERRIDE | 718 virtual void afterTest() OVERRIDE |
| 719 { | 719 { |
| 720 } | 720 } |
| 721 | 721 |
| 722 private: | 722 private: |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2096 } | 2096 } |
| 2097 | 2097 |
| 2098 TEST_F(LayerTreeHostTestMaxPendingFrames, GLRenderer) | 2098 TEST_F(LayerTreeHostTestMaxPendingFrames, GLRenderer) |
| 2099 { | 2099 { |
| 2100 m_delegatingRenderer = false; | 2100 m_delegatingRenderer = false; |
| 2101 runTest(true); | 2101 runTest(true); |
| 2102 } | 2102 } |
| 2103 | 2103 |
| 2104 } // namespace | 2104 } // namespace |
| 2105 } // namespace cc | 2105 } // namespace cc |
| OLD | NEW |