Chromium Code Reviews| Index: cc/trees/layer_tree_host_unittest.cc |
| diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc |
| index 3426d41fe446a15f5982801e99a5df4d09896e65..d471b069f7d2ffba6c05dc1750db023de80fd506 100644 |
| --- a/cc/trees/layer_tree_host_unittest.cc |
| +++ b/cc/trees/layer_tree_host_unittest.cc |
| @@ -626,6 +626,52 @@ class LayerTreeHostTestCommit : public LayerTreeHostTest { |
| MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); |
| +// This test verifies that LayerTreeHostImpl's current frame time gets |
| +// updated in consecutive frames, even when it doesn't draw due to tree |
| +// activation failure. |
| +class LayerTreeHostTestFrameTimeUpdates : public LayerTreeHostTest { |
| + public: |
| + LayerTreeHostTestFrameTimeUpdates() : frame_(0) {} |
| + |
| + virtual void BeginTest() OVERRIDE { |
| + layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| + layer_tree_host()->set_background_color(SK_ColorGRAY); |
| + |
| + PostSetNeedsCommitToMainThread(); |
| + } |
| + |
| + virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| + if (frame_ >= 1) { |
| + EXPECT_NE(first_frame_time_, impl->CurrentFrameTimeTicks()); |
| + EndTest(); |
| + return; |
| + } |
| + |
| + EXPECT_FALSE(impl->settings().impl_side_painting); |
| + 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.
|
| + first_frame_time_ = impl->CurrentFrameTimeTicks(); |
| + impl->SetNeedsRedraw(); |
| + } |
| + |
| + virtual bool CanActivatePendingTree(LayerTreeHostImpl* impl) OVERRIDE { |
| + frame_++; |
| + if (frame_ == 1) { |
| + first_frame_time_ = impl->CurrentFrameTimeTicks(); |
| + return false; |
| + } |
| + |
| + return true; |
| + } |
| + |
| + virtual void AfterTest() OVERRIDE {} |
| + |
| + private: |
| + int frame_; |
| + base::TimeTicks first_frame_time_; |
| +}; |
| + |
| +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestFrameTimeUpdates); |
| + |
| // Verifies that StartPageScaleAnimation events propagate correctly |
| // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. |
| class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { |