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

Unified Diff: ash/desktop_background/wallpaper_resizer_unittest.cc

Issue 81393004: ash: Avoid reloading already-resized custom wallpaper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style fix Created 7 years, 1 month 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 | « ash/desktop_background/wallpaper_resizer.cc ('k') | ash/test/test_user_wallpaper_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/desktop_background/wallpaper_resizer_unittest.cc
diff --git a/ash/desktop_background/wallpaper_resizer_unittest.cc b/ash/desktop_background/wallpaper_resizer_unittest.cc
index 844730769556dced30e6712ddc87b016093fda18..7ff043550360a90ee233703c17f14228a00c0b68 100644
--- a/ash/desktop_background/wallpaper_resizer_unittest.cc
+++ b/ash/desktop_background/wallpaper_resizer_unittest.cc
@@ -41,7 +41,8 @@ gfx::ImageSkia CreateTestImage(const gfx::Size& size) {
}
}
- return gfx::ImageSkia::CreateFrom1xBitmap(src);
+ gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(src);
+ return image;
}
bool IsColor(const gfx::ImageSkia& image, const uint32_t expect) {
@@ -74,7 +75,7 @@ class WallpaperResizerTest : public testing::Test,
resizer->StartResize();
WaitForResize();
resizer->RemoveObserver(this);
- return resizer->wallpaper_image();
+ return resizer->image();
}
void WaitForResize() {
@@ -141,5 +142,20 @@ TEST_F(WallpaperResizerTest, AllLayoutDifferent) {
EXPECT_TRUE(IsColor(tile, kExpectedTile));
}
+TEST_F(WallpaperResizerTest, ImageId) {
+ gfx::ImageSkia image = CreateTestImage(
+ gfx::Size(kTestImageWidth, kTestImageHeight));
+
+ // Create a WallpaperResizer and check that it reports an original image ID
+ // both pre- and post-resize that matches the ID returned by GetImageId().
+ WallpaperResizer resizer(image, gfx::Size(10, 20), WALLPAPER_LAYOUT_STRETCH);
+ EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id());
+ resizer.AddObserver(this);
+ resizer.StartResize();
+ WaitForResize();
+ resizer.RemoveObserver(this);
+ EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id());
+}
+
} // namespace internal
} // namespace ash
« no previous file with comments | « ash/desktop_background/wallpaper_resizer.cc ('k') | ash/test/test_user_wallpaper_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698