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 0102a10617605b86d1329bba60262884a8046fd9..669dbe51ce6f7fea1297ea28260e3fc9c3930600 100644 |
| --- a/cc/trees/layer_tree_host_unittest.cc |
| +++ b/cc/trees/layer_tree_host_unittest.cc |
| @@ -503,6 +503,58 @@ class LayerTreeHostTestCompositeAndReadbackBeforePreviousCommitDraws |
| MULTI_THREAD_TEST_F( |
| LayerTreeHostTestCompositeAndReadbackBeforePreviousCommitDraws); |
| +class LayerTreeHostTestCompositeAndReadbackDuringForcedDraw |
| + : public LayerTreeHostTest { |
| + protected: |
| + LayerTreeHostTestCompositeAndReadbackDuringForcedDraw() |
| + : prepare_to_draw_count_(0) {} |
| + |
| + virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| + // This enables forced draws after a single prepare to draw failure. |
| + settings->timeout_and_draw_when_animation_checkerboards = true; |
| + settings->maximum_number_of_failed_draws_before_draw_is_forced_ = 1; |
| + } |
| + |
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| + |
| + virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| + LayerTreeHostImpl::FrameData* frame_data, |
| + bool result) OVERRIDE { |
| + prepare_to_draw_count_++; |
| + EXPECT_LE(prepare_to_draw_count_, 3); |
| + |
| + // Before we react to the failed draw by initiating the forced draw |
| + // sequence, start a readback on the main thread. |
| + if (prepare_to_draw_count_ == |
| + host_impl->settings() |
| + .maximum_number_of_failed_draws_before_draw_is_forced_) { |
| + PostReadbackToMainThread(); |
| + } |
| + |
| + // Returning false will eventually result in a forced draw. |
| + return false; |
| + } |
| + |
| + virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| + // We should only draw for the readback and the forced draw. |
| + EXPECT_GE(prepare_to_draw_count_, 2); |
| + EXPECT_LE(prepare_to_draw_count_, 3); |
| + } |
| + |
| + virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, |
| + bool result) OVERRIDE { |
| + // We should only swap for the forced draw. |
| + EXPECT_EQ(prepare_to_draw_count_, 3); |
|
brianderson
2013/09/04 21:34:39
This expectation fails with the delegated renderer
brianderson
2013/09/04 21:48:59
I looks like the delegating renderer cannot do a r
|
| + EndTest(); |
| + } |
| + |
| + virtual void AfterTest() OVERRIDE {} |
| + |
| + int prepare_to_draw_count_; |
| +}; |
| + |
| +MULTI_THREAD_TEST_F(LayerTreeHostTestCompositeAndReadbackDuringForcedDraw); |
| + |
| // If the layerTreeHost says it can't draw, Then we should not try to draw. |
| class LayerTreeHostTestCanDrawBlocksDrawing : public LayerTreeHostTest { |
| public: |