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

Unified Diff: cc/tiles/image_controller_unittest.cc

Issue 2926513003: Use PaintImage in cc QueueImageDecode
Patch Set: rebase 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/tiles/image_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/image_controller_unittest.cc
diff --git a/cc/tiles/image_controller_unittest.cc b/cc/tiles/image_controller_unittest.cc
index a4a565774a4631725a4d3d3c849871169579a7d9..796f4a87670f5798784c9ca3697ffacb5630873b 100644
--- a/cc/tiles/image_controller_unittest.cc
+++ b/cc/tiles/image_controller_unittest.cc
@@ -237,7 +237,8 @@ int kDefaultTimeoutSeconds = 10;
class ImageControllerTest : public testing::Test {
public:
ImageControllerTest() : task_runner_(base::SequencedTaskRunnerHandle::Get()) {
- image_ = CreateDiscardableImage(gfx::Size(1, 1));
+ image_ = PaintImage(PaintImage::GetNextId(),
+ CreateDiscardableImage(gfx::Size(1, 1)));
}
~ImageControllerTest() override = default;
@@ -257,7 +258,7 @@ class ImageControllerTest : public testing::Test {
base::SequencedTaskRunner* task_runner() { return task_runner_.get(); }
ImageController* controller() { return controller_.get(); }
TestableCache* cache() { return &cache_; }
- sk_sp<const SkImage> image() const { return image_; }
+ PaintImage image() const { return image_; }
// Timeout callback, which errors and exits the runloop.
static void Timeout(base::RunLoop* run_loop) {
@@ -282,7 +283,7 @@ class ImageControllerTest : public testing::Test {
scoped_refptr<WorkerTaskRunner> worker_task_runner_;
TestableCache cache_;
std::unique_ptr<ImageController> controller_;
- sk_sp<const SkImage> image_;
+ PaintImage image_;
};
TEST_F(ImageControllerTest, NullControllerUnrefsImages) {
@@ -302,7 +303,7 @@ TEST_F(ImageControllerTest, NullControllerUnrefsImages) {
TEST_F(ImageControllerTest, QueueImageDecode) {
base::RunLoop run_loop;
DecodeClient decode_client;
- EXPECT_EQ(image()->bounds().width(), 1);
+ EXPECT_EQ(image().sk_image()->bounds().width(), 1);
ImageController::ImageDecodeRequestId expected_id =
controller()->QueueImageDecode(
image(),
@@ -320,7 +321,7 @@ TEST_F(ImageControllerTest, QueueImageDecodeNonLazy) {
SkBitmap bitmap;
bitmap.allocN32Pixels(1, 1);
- sk_sp<const SkImage> image = SkImage::MakeFromBitmap(bitmap);
+ PaintImage image(PaintImage::GetNextId(), SkImage::MakeFromBitmap(bitmap));
ImageController::ImageDecodeRequestId expected_id =
controller()->QueueImageDecode(
@@ -336,8 +337,9 @@ TEST_F(ImageControllerTest, QueueImageDecodeNonLazy) {
TEST_F(ImageControllerTest, QueueImageDecodeTooLarge) {
base::RunLoop run_loop;
DecodeClient decode_client;
+ PaintImage image(PaintImage::GetNextId(),
+ CreateDiscardableImage(gfx::Size(2000, 2000)));
- sk_sp<const SkImage> image = CreateDiscardableImage(gfx::Size(2000, 2000));
ImageController::ImageDecodeRequestId expected_id =
controller()->QueueImageDecode(
image,
« no previous file with comments | « cc/tiles/image_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698