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

Unified Diff: cc/tiles/gpu_image_decode_controller_unittest.cc

Issue 1933723002: cc: Unittest for checking already failed image decode task. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@land_task_manager
Patch Set: Created 4 years, 8 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/tiles/gpu_image_decode_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/gpu_image_decode_controller_unittest.cc
diff --git a/cc/tiles/gpu_image_decode_controller_unittest.cc b/cc/tiles/gpu_image_decode_controller_unittest.cc
index 39a02f75fb729280f09c2ea9317b52654697b0ee..1891f2e55710e4e4ec3ac055a2327a02038063d0 100644
--- a/cc/tiles/gpu_image_decode_controller_unittest.cc
+++ b/cc/tiles/gpu_image_decode_controller_unittest.cc
@@ -357,6 +357,40 @@ TEST(GpuImageDecodeControllerTest,
controller.UnrefImage(draw_image);
}
+TEST(GpuImageDecodeControllerTest, NoTaskForImageAlreadyFailedDecoding) {
+ auto context_provider = TestContextProvider::Create();
+ context_provider->BindToCurrentThread();
+ GpuImageDecodeController controller(context_provider.get(),
+ ResourceFormat::RGBA_8888);
+ bool is_decomposable = true;
+ SkFilterQuality quality = kHigh_SkFilterQuality;
+
+ sk_sp<SkImage> image = CreateImage(100, 100);
+ DrawImage draw_image(image, SkIRect::MakeWH(image->width(), image->height()),
+ quality,
+ CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
+ scoped_refptr<TileTask> task;
+ bool need_unref = controller.GetTaskForImageAndRef(
+ draw_image, ImageDecodeController::TracingInfo(), &task);
+ EXPECT_TRUE(need_unref);
+ EXPECT_TRUE(task);
+
+ ProcessTask(task->dependencies()[0].get());
+ ScheduleTask(task.get());
+ // Didn't run the task, complete it (it was canceled).
+ CompleteTask(task.get());
+
+ controller.SetImageDecodingFailedForTesting(draw_image);
+
+ scoped_refptr<TileTask> another_task;
+ need_unref = controller.GetTaskForImageAndRef(
+ draw_image, ImageDecodeController::TracingInfo(), &another_task);
+ EXPECT_FALSE(need_unref);
+ EXPECT_EQ(another_task.get(), nullptr);
+
+ controller.UnrefImage(draw_image);
+}
+
TEST(GpuImageDecodeControllerTest, GetDecodedImageForDraw) {
auto context_provider = TestContextProvider::Create();
context_provider->BindToCurrentThread();
« no previous file with comments | « cc/tiles/gpu_image_decode_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698