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/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 265 } | 265 } |
| 266 | 266 |
| 267 private: | 267 private: |
| 268 FakeContentLayerClient client_; | 268 FakeContentLayerClient client_; |
| 269 }; | 269 }; |
| 270 | 270 |
| 271 // Note: With this test setup, we only get tiles flagged as REQUIRED_FOR_DRAW in | 271 // Note: With this test setup, we only get tiles flagged as REQUIRED_FOR_DRAW in |
| 272 // single threaded mode. | 272 // single threaded mode. |
| 273 SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawNonEmpty); | 273 SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawNonEmpty); |
| 274 | 274 |
| 275 // This tests if we get the READY_TO_DRAW signal if we become invisible and then | |
| 276 // become visible again. | |
| 277 class LayerTreeHostTestReadyToDrawVisibility | |
| 278 : public LayerTreeHostTestReadyToDrawNonEmpty { | |
| 279 public: | |
| 280 LayerTreeHostTestReadyToDrawVisibility() | |
| 281 : LayerTreeHostTestReadyToDrawNonEmpty(), commit_count_(0) {} | |
| 282 | |
| 283 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | |
| 284 commit_count_++; | |
| 285 if (commit_count_ == 1) { | |
| 286 DebugScopedSetMainThread main(proxy()); | |
| 287 layer_tree_host()->SetVisible(false); | |
|
brianderson
2015/07/23 22:58:15
EXPECT_FALSE(host_impl->visible()) here?
sunnyps
2015/07/23 23:10:50
Done.
| |
| 288 } | |
| 289 } | |
| 290 | |
| 291 void DidFinishImplFrameOnThread(LayerTreeHostImpl* host_impl) override { | |
| 292 if (commit_count_ == 1) { | |
| 293 DebugScopedSetMainThread main(proxy()); | |
| 294 layer_tree_host()->SetVisible(true); | |
|
brianderson
2015/07/23 22:58:15
EXPECT_TRUE(host_impl->visible()) here?
sunnyps
2015/07/23 23:10:50
Done.
| |
| 295 } | |
| 296 } | |
| 297 | |
| 298 void AfterTest() override { | |
| 299 LayerTreeHostTestReadyToDrawNonEmpty::AfterTest(); | |
| 300 EXPECT_EQ(2, commit_count_); | |
| 301 } | |
| 302 | |
| 303 private: | |
| 304 int commit_count_; | |
| 305 }; | |
| 306 | |
| 307 // Note: With this test setup, we only get tiles flagged as REQUIRED_FOR_DRAW in | |
| 308 // single threaded mode. | |
| 309 SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawVisibility); | |
| 310 | |
| 275 class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest { | 311 class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest { |
| 276 public: | 312 public: |
| 277 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { | 313 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { |
| 278 auto output_surface = make_scoped_ptr(new testing::StrictMock< | 314 auto output_surface = make_scoped_ptr(new testing::StrictMock< |
| 279 MockSetWorkerContextShouldAggressivelyFreeResourcesOutputSurface>( | 315 MockSetWorkerContextShouldAggressivelyFreeResourcesOutputSurface>( |
| 280 delegating_renderer())); | 316 delegating_renderer())); |
| 281 | 317 |
| 282 // At init, we expect one call to set visibility to true. | 318 // At init, we expect one call to set visibility to true. |
| 283 testing::Expectation visibility_true = | 319 testing::Expectation visibility_true = |
| 284 EXPECT_CALL(*output_surface, | 320 EXPECT_CALL(*output_surface, |
| (...skipping 5770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6055 void AfterTest() override {} | 6091 void AfterTest() override {} |
| 6056 | 6092 |
| 6057 std::vector<int> affected_by_page_scale_; | 6093 std::vector<int> affected_by_page_scale_; |
| 6058 std::vector<int> not_affected_by_page_scale_; | 6094 std::vector<int> not_affected_by_page_scale_; |
| 6059 }; | 6095 }; |
| 6060 | 6096 |
| 6061 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestPageScaleFlags); | 6097 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestPageScaleFlags); |
| 6062 | 6098 |
| 6063 } // namespace | 6099 } // namespace |
| 6064 } // namespace cc | 6100 } // namespace cc |
| OLD | NEW |