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/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 using testing::_; | 62 using testing::_; |
63 using testing::AnyNumber; | 63 using testing::AnyNumber; |
64 using testing::AtLeast; | 64 using testing::AtLeast; |
65 using testing::Mock; | 65 using testing::Mock; |
66 | 66 |
67 namespace cc { | 67 namespace cc { |
68 namespace { | 68 namespace { |
69 | 69 |
70 class LayerTreeHostTest : public LayerTreeTest {}; | 70 class LayerTreeHostTest : public LayerTreeTest {}; |
71 | 71 |
72 // Test if the LTHI receives ReadyToActivate and ReadyToDraw notifications from | |
73 // the TileManager. | |
74 class LayerTreeHostTestNotifications : public LayerTreeHostTest { | |
75 public: | |
76 LayerTreeHostTestNotifications() | |
77 : did_notify_ready_to_activate_(false), | |
78 did_notify_ready_to_draw_(false) {} | |
79 | |
80 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | |
81 | |
82 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { | |
83 did_notify_ready_to_activate_ = true; | |
84 if (did_notify_ready_to_draw_) | |
85 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
| |
86 } | |
87 | |
88 void NotifyReadyToDrawOnThread(LayerTreeHostImpl* impl) override { | |
89 did_notify_ready_to_draw_ = true; | |
90 if (did_notify_ready_to_activate_) | |
91 EndTest(); | |
92 } | |
93 | |
94 void AfterTest() override { | |
95 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
| |
96 EXPECT_TRUE(did_notify_ready_to_draw_); | |
97 } | |
98 | |
99 private: | |
100 bool did_notify_ready_to_activate_; | |
101 bool did_notify_ready_to_draw_; | |
102 }; | |
103 | |
104 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestNotifications); | |
105 | |
72 // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1 | 106 // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1 |
73 // draw with frame 0. | 107 // draw with frame 0. |
74 class LayerTreeHostTestSetNeedsCommit1 : public LayerTreeHostTest { | 108 class LayerTreeHostTestSetNeedsCommit1 : public LayerTreeHostTest { |
75 public: | 109 public: |
76 LayerTreeHostTestSetNeedsCommit1() : num_commits_(0), num_draws_(0) {} | 110 LayerTreeHostTestSetNeedsCommit1() : num_commits_(0), num_draws_(0) {} |
77 | 111 |
78 void BeginTest() override { | 112 void BeginTest() override { |
79 PostSetNeedsCommitToMainThread(); | 113 PostSetNeedsCommitToMainThread(); |
80 PostSetNeedsCommitToMainThread(); | 114 PostSetNeedsCommitToMainThread(); |
81 } | 115 } |
(...skipping 5117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5199 void AfterTest() override { | 5233 void AfterTest() override { |
5200 EXPECT_TRUE(deltas_sent_to_client_); | 5234 EXPECT_TRUE(deltas_sent_to_client_); |
5201 } | 5235 } |
5202 | 5236 |
5203 ScrollAndScaleSet info_; | 5237 ScrollAndScaleSet info_; |
5204 bool deltas_sent_to_client_; | 5238 bool deltas_sent_to_client_; |
5205 }; | 5239 }; |
5206 | 5240 |
5207 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); | 5241 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); |
5208 } // namespace cc | 5242 } // namespace cc |
OLD | NEW |