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 aedd0d937a43a69ffce015ea7507f522556a406a..06d1393dd3831c0d060e6c86df4c2e57d659b231 100644 |
| --- a/cc/trees/layer_tree_host_unittest.cc |
| +++ b/cc/trees/layer_tree_host_unittest.cc |
| @@ -69,6 +69,40 @@ namespace { |
| class LayerTreeHostTest : public LayerTreeTest {}; |
| +// Test if the LTHI receives ReadyToActivate and ReadyToDraw notifications from |
| +// the TileManager. |
| +class LayerTreeHostTestNotifications : public LayerTreeHostTest { |
| + public: |
| + LayerTreeHostTestNotifications() |
| + : did_notify_ready_to_activate_(false), |
| + did_notify_ready_to_draw_(false) {} |
| + |
| + void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| + |
| + void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { |
| + did_notify_ready_to_activate_ = true; |
| + if (did_notify_ready_to_draw_) |
| + EndTest(); |
|
danakj
2014/11/07 19:08:18
It's much nicer to understand the test if there is
ernstm
2014/11/08 01:57:26
Done. I created separate tests for ReadyToActivate
|
| + } |
| + |
| + void NotifyReadyToDrawOnThread(LayerTreeHostImpl* impl) override { |
| + did_notify_ready_to_draw_ = true; |
| + if (did_notify_ready_to_activate_) |
| + EndTest(); |
| + } |
| + |
| + void AfterTest() override { |
| + EXPECT_TRUE(did_notify_ready_to_activate_); |
|
danakj
2014/11/07 19:08:18
I was kinda expecting a test that was more long th
|
| + EXPECT_TRUE(did_notify_ready_to_draw_); |
| + } |
| + |
| + private: |
| + bool did_notify_ready_to_activate_; |
| + bool did_notify_ready_to_draw_; |
| +}; |
| + |
| +SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestNotifications); |
| + |
| // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1 |
| // draw with frame 0. |
| class LayerTreeHostTestSetNeedsCommit1 : public LayerTreeHostTest { |