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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 287643004: Re-land: cc: Examine layers to determine if we're ready to activate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: init check_if_ready_to_activate_pending_ properly Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/resources/tile_manager.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 contents_scale = 0.5f; 2384 contents_scale = 0.5f;
2385 2385
2386 SetContentsScaleOnBothLayers(contents_scale, 2386 SetContentsScaleOnBothLayers(contents_scale,
2387 device_scale, 2387 device_scale,
2388 page_scale, 2388 page_scale,
2389 maximum_animation_scale, 2389 maximum_animation_scale,
2390 animating_transform); 2390 animating_transform);
2391 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); 2391 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
2392 } 2392 }
2393 2393
2394 TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) {
2395 gfx::Size tile_size(100, 100);
2396 gfx::Size layer_bounds(1000, 1000);
2397
2398 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
2399
2400 // Make sure some tiles are not shared.
2401 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size));
2402
2403 CreateHighLowResAndSetAllTilesVisible();
2404 active_layer_->SetAllTilesReady();
2405 pending_layer_->MarkVisibleResourcesAsRequired();
2406
2407 // All pending layer tiles required are not ready.
2408 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2409
2410 // Initialize all low-res tiles.
2411 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling());
2412
2413 // Low-res tiles should not be enough.
2414 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2415
2416 // Initialize remaining tiles.
2417 pending_layer_->SetAllTilesReady();
2418
2419 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2420 }
2421
2422 TEST_F(PictureLayerImplTest, HighResReadyToDrawNotEnoughToActivate) {
2423 gfx::Size tile_size(100, 100);
2424 gfx::Size layer_bounds(1000, 1000);
2425
2426 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
2427
2428 // Make sure some tiles are not shared.
2429 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size));
2430
2431 CreateHighLowResAndSetAllTilesVisible();
2432 active_layer_->SetAllTilesReady();
2433 pending_layer_->MarkVisibleResourcesAsRequired();
2434
2435 // All pending layer tiles required are not ready.
2436 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2437
2438 // Initialize all high-res tiles.
2439 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
2440
2441 // High-res tiles should not be enough.
2442 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2443
2444 // Initialize remaining tiles.
2445 pending_layer_->SetAllTilesReady();
2446
2447 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2448 }
2449
2394 } // namespace 2450 } // namespace
2395 } // namespace cc 2451 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/resources/tile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698