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

Unified Diff: cc/trees/layer_tree_host_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 14af3bee748366affb4fc79fb46ca9eae7e591a7..4b824ee798b076a1d9a0e9aecb9729f2ae01ae92 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -7794,19 +7794,40 @@ class LayerTreeHostTestQueueImageDecode : public LayerTreeHostTest {
protected:
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+ void InitializeSettings(LayerTreeSettings* settings) override {
+ settings->enable_checker_imaging = true;
+ }
+
void WillBeginMainFrame() override {
if (!first_)
return;
first_ = false;
- PaintImage image(PaintImage::GetNextId(),
- CreateDiscardableImage(gfx::Size(10, 10)));
+ image_ = PaintImage(PaintImage::GetNextId(),
+ CreateDiscardableImage(gfx::Size(400, 400)));
auto callback =
base::Bind(&LayerTreeHostTestQueueImageDecode::ImageDecodeFinished,
base::Unretained(this));
// Schedule the decode twice for the same image.
- layer_tree_host()->QueueImageDecode(image, callback);
- layer_tree_host()->QueueImageDecode(image, callback);
+ layer_tree_host()->QueueImageDecode(image_, callback);
+ layer_tree_host()->QueueImageDecode(image_, callback);
+ }
+
+ void ReadyToCommitOnThread(LayerTreeHostImpl* impl) override {
+ if (one_commit_done_)
+ return;
+ EXPECT_TRUE(
+ impl->tile_manager()->checker_image_tracker().ShouldCheckerImage(
+ image_, WhichTree::PENDING_TREE));
+ // Reset the tracker as if it has never seen this image.
+ impl->tile_manager()->checker_image_tracker().ClearTracker(true);
+ }
+
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
+ one_commit_done_ = true;
+ EXPECT_FALSE(
+ impl->tile_manager()->checker_image_tracker().ShouldCheckerImage(
+ image_, WhichTree::PENDING_TREE));
}
void ImageDecodeFinished(bool decode_succeeded) {
@@ -7821,7 +7842,9 @@ class LayerTreeHostTestQueueImageDecode : public LayerTreeHostTest {
private:
bool first_ = true;
+ bool one_commit_done_ = false;
int finished_decode_count_ = 0;
+ PaintImage image_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestQueueImageDecode);
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698