Chromium Code Reviews| 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 |