Chromium Code Reviews| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 EXPECT_EQ(5.f, impl->active_tree()->page_scale_factor()); | 619 EXPECT_EQ(5.f, impl->active_tree()->page_scale_factor()); |
| 620 | 620 |
| 621 EndTest(); | 621 EndTest(); |
| 622 } | 622 } |
| 623 | 623 |
| 624 virtual void AfterTest() OVERRIDE {} | 624 virtual void AfterTest() OVERRIDE {} |
| 625 }; | 625 }; |
| 626 | 626 |
| 627 MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); | 627 MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); |
| 628 | 628 |
| 629 // This test verifies that LayerTreeHostImpl's current frame time gets | |
| 630 // updated in consecutive frames, even when it doesn't draw due to tree | |
| 631 // activation failure. | |
| 632 class LayerTreeHostTestFrameTimeUpdates : public LayerTreeHostTest { | |
| 633 public: | |
| 634 LayerTreeHostTestFrameTimeUpdates() : frame_(0) {} | |
| 635 | |
| 636 virtual void BeginTest() OVERRIDE { | |
| 637 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); | |
| 638 layer_tree_host()->set_background_color(SK_ColorGRAY); | |
| 639 | |
| 640 PostSetNeedsCommitToMainThread(); | |
| 641 } | |
| 642 | |
| 643 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | |
| 644 if (frame_ >= 1) { | |
| 645 EXPECT_NE(first_frame_time_, impl->CurrentFrameTimeTicks()); | |
| 646 EndTest(); | |
| 647 return; | |
| 648 } | |
| 649 | |
| 650 EXPECT_FALSE(impl->settings().impl_side_painting); | |
| 651 frame_ = 1; | |
|
danakj
2013/05/16 15:37:18
I think you can just EndTest() here, as this test
ajuma
2013/05/16 17:24:34
Done.
| |
| 652 first_frame_time_ = impl->CurrentFrameTimeTicks(); | |
| 653 impl->SetNeedsRedraw(); | |
| 654 } | |
| 655 | |
| 656 virtual bool CanActivatePendingTree(LayerTreeHostImpl* impl) OVERRIDE { | |
| 657 frame_++; | |
| 658 if (frame_ == 1) { | |
| 659 first_frame_time_ = impl->CurrentFrameTimeTicks(); | |
| 660 return false; | |
| 661 } | |
| 662 | |
| 663 return true; | |
| 664 } | |
| 665 | |
| 666 virtual void AfterTest() OVERRIDE {} | |
| 667 | |
| 668 private: | |
| 669 int frame_; | |
| 670 base::TimeTicks first_frame_time_; | |
| 671 }; | |
| 672 | |
| 673 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestFrameTimeUpdates); | |
| 674 | |
| 629 // Verifies that StartPageScaleAnimation events propagate correctly | 675 // Verifies that StartPageScaleAnimation events propagate correctly |
| 630 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. | 676 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. |
| 631 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { | 677 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { |
| 632 public: | 678 public: |
| 633 LayerTreeHostTestStartPageScaleAnimation() {} | 679 LayerTreeHostTestStartPageScaleAnimation() {} |
| 634 | 680 |
| 635 virtual void SetupTree() OVERRIDE { | 681 virtual void SetupTree() OVERRIDE { |
| 636 LayerTreeHostTest::SetupTree(); | 682 LayerTreeHostTest::SetupTree(); |
| 637 | 683 |
| 638 scroll_layer_ = FakeContentLayer::Create(&client_); | 684 scroll_layer_ = FakeContentLayer::Create(&client_); |
| (...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2947 TEST_F(LayerTreeHostTestNumFramesPending, DelegatingRenderer) { | 2993 TEST_F(LayerTreeHostTestNumFramesPending, DelegatingRenderer) { |
| 2948 RunTest(true, true, true); | 2994 RunTest(true, true, true); |
| 2949 } | 2995 } |
| 2950 | 2996 |
| 2951 TEST_F(LayerTreeHostTestNumFramesPending, GLRenderer) { | 2997 TEST_F(LayerTreeHostTestNumFramesPending, GLRenderer) { |
| 2952 RunTest(true, false, true); | 2998 RunTest(true, false, true); |
| 2953 } | 2999 } |
| 2954 | 3000 |
| 2955 } // namespace | 3001 } // namespace |
| 2956 } // namespace cc | 3002 } // namespace cc |
| OLD | NEW |