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

Side by Side Diff: cc/tiles/checker_image_tracker_unittest.cc

Issue 2927573003: cc: Disallow img.decode images from being checker imaged. (Closed)
Patch Set: update Created 3 years, 6 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/tiles/checker_image_tracker.cc ('k') | cc/tiles/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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/tiles/checker_image_tracker.h" 5 #include "cc/tiles/checker_image_tracker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 // Change the partial image to complete and try again. It should still not 409 // Change the partial image to complete and try again. It should still not
410 // be checkered. 410 // be checkered.
411 gfx::Size image_size = gfx::Size(partial_image.sk_image()->width(), 411 gfx::Size image_size = gfx::Size(partial_image.sk_image()->width(),
412 partial_image.sk_image()->height()); 412 partial_image.sk_image()->height());
413 PaintImage completed_paint_image = 413 PaintImage completed_paint_image =
414 PaintImage(partial_image.stable_id(), CreateDiscardableImage(image_size)); 414 PaintImage(partial_image.stable_id(), CreateDiscardableImage(image_size));
415 EXPECT_FALSE(checker_image_tracker_->ShouldCheckerImage( 415 EXPECT_FALSE(checker_image_tracker_->ShouldCheckerImage(
416 completed_paint_image, WhichTree::PENDING_TREE)); 416 completed_paint_image, WhichTree::PENDING_TREE));
417 } 417 }
418 418
419 TEST_F(CheckerImageTrackerTest, DontCheckerDisallowedImages) {
420 SetUpTracker(true);
421
422 PaintImage image = CreateImage(ImageType::CHECKERABLE);
423 EXPECT_TRUE(checker_image_tracker_->ShouldCheckerImage(
424 image, WhichTree::PENDING_TREE));
425 checker_image_tracker_->DisallowCheckeringForImage(image);
426 // Since the tracker already saw the image, even disallowing it would still
427 // ensure that we checker it until it's completed.
428 EXPECT_TRUE(checker_image_tracker_->ShouldCheckerImage(
429 image, WhichTree::PENDING_TREE));
430
431 // Reset the tracker.
432 checker_image_tracker_->ClearTracker(true);
433 // If we haven't seen the image and disallow it first, then it's not
434 // checkerable anymore.
435 checker_image_tracker_->DisallowCheckeringForImage(image);
436 EXPECT_FALSE(checker_image_tracker_->ShouldCheckerImage(
437 image, WhichTree::PENDING_TREE));
438 }
439
419 } // namespace 440 } // namespace
420 } // namespace cc 441 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/checker_image_tracker.cc ('k') | cc/tiles/tile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698