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

Unified Diff: cc/tiles/image_controller_unittest.cc

Issue 2668873002: cc: Add checker-imaging support to TileManager. (Closed)
Patch Set: addressed comments Created 3 years, 10 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
Index: cc/tiles/image_controller_unittest.cc
diff --git a/cc/tiles/image_controller_unittest.cc b/cc/tiles/image_controller_unittest.cc
index ddd537617a2a4cc5d891466d344dbdfa9081ed97..90d151b9880280d4b8db80d94ef61dc182aa69f0 100644
--- a/cc/tiles/image_controller_unittest.cc
+++ b/cc/tiles/image_controller_unittest.cc
@@ -447,5 +447,32 @@ TEST_F(ImageControllerTest, QueueImageDecodeLockedImageControllerChange) {
EXPECT_EQ(0, cache()->number_of_refs());
}
+TEST_F(ImageControllerTest, DispatchesDecodeCallbacksAfterCacheChanged) {
Khushal 2017/02/17 19:05:38 I added the test. Since I stumbled onto the multip
+ scoped_refptr<SimpleTask> task(new SimpleTask);
+ cache()->SetTaskToUse(task);
+
+ base::RunLoop run_loop1;
+ DecodeClient decode_client1;
+ base::RunLoop run_loop2;
+ DecodeClient decode_client2;
+
+ controller()->QueueImageDecode(
+ image(),
+ base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client1),
+ run_loop1.QuitClosure()));
+ controller()->QueueImageDecode(
+ image(),
+ base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
+ run_loop2.QuitClosure()));
+
+ // Now reset the image cache before decode completed callbacks are posted to
+ // the compositor thread. Ensure that the completion callbacks for the decode
+ // is still run.
+ TestableCache new_cache;
+ controller()->SetImageDecodeCache(&new_cache);
+ RunOrTimeout(&run_loop1);
+ RunOrTimeout(&run_loop2);
+}
+
} // namespace
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698