Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 1239843002: cc: Call PrepareTiles when becoming visible in browser only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error - size_t infects everything! Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 that we get the ready to draw signal eventually even if we become
276 // invisible and then become visible again.
277 class LayerTreeHostTestReadyToDrawVisibility
278 : public LayerTreeHostTestReadyToDrawNonEmpty {
279 public:
280 LayerTreeHostTestReadyToDrawVisibility()
281 : LayerTreeHostTestReadyToDrawNonEmpty(), did_commit_(false) {}
282
283 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
284 EXPECT_FALSE(did_commit_);
285 did_commit_ = true;
286 PostSetVisibleToMainThread(false);
287 }
288
289 void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl,
290 bool visible) override {
291 if (!visible) {
292 EXPECT_TRUE(did_commit_);
293 EXPECT_FALSE(did_notify_ready_to_draw_);
294 PostSetVisibleToMainThread(true);
295 }
296 }
297
298 protected:
299 bool did_commit_;
300 };
301
302 SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawVisibility);
303
275 class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest { 304 class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest {
276 public: 305 public:
277 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { 306 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override {
278 auto output_surface = make_scoped_ptr(new testing::StrictMock< 307 auto output_surface = make_scoped_ptr(new testing::StrictMock<
279 MockSetWorkerContextShouldAggressivelyFreeResourcesOutputSurface>( 308 MockSetWorkerContextShouldAggressivelyFreeResourcesOutputSurface>(
280 delegating_renderer())); 309 delegating_renderer()));
281 310
282 // At init, we expect one call to set visibility to true. 311 // At init, we expect one call to set visibility to true.
283 testing::Expectation visibility_true = 312 testing::Expectation visibility_true =
284 EXPECT_CALL(*output_surface, 313 EXPECT_CALL(*output_surface,
(...skipping 5767 matching lines...) Expand 10 before | Expand all | Expand 10 after
6052 void AfterTest() override {} 6081 void AfterTest() override {}
6053 6082
6054 std::vector<int> affected_by_page_scale_; 6083 std::vector<int> affected_by_page_scale_;
6055 std::vector<int> not_affected_by_page_scale_; 6084 std::vector<int> not_affected_by_page_scale_;
6056 }; 6085 };
6057 6086
6058 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestPageScaleFlags); 6087 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestPageScaleFlags);
6059 6088
6060 } // namespace 6089 } // namespace
6061 } // namespace cc 6090 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698