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

Side by Side Diff: trunk/src/ash/desktop_background/wallpaper_resizer_unittest.cc

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/apps/shell_window.cc ('k') | trunk/src/ash/display/mirror_window_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/desktop_background/wallpaper_resizer.h" 5 #include "ash/desktop_background/wallpaper_resizer.h"
6 6
7 #include "ash/desktop_background/wallpaper_resizer_observer.h" 7 #include "ash/desktop_background/wallpaper_resizer_observer.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/public/test/test_browser_thread.h" 9 #include "content/public/test/test_browser_thread.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 WallpaperLayout layouts[4] = { 97 WallpaperLayout layouts[4] = {
98 WALLPAPER_LAYOUT_CENTER, 98 WALLPAPER_LAYOUT_CENTER,
99 WALLPAPER_LAYOUT_CENTER_CROPPED, 99 WALLPAPER_LAYOUT_CENTER_CROPPED,
100 WALLPAPER_LAYOUT_STRETCH, 100 WALLPAPER_LAYOUT_STRETCH,
101 WALLPAPER_LAYOUT_TILE, 101 WALLPAPER_LAYOUT_TILE,
102 }; 102 };
103 const int length = arraysize(layouts); 103 const int length = arraysize(layouts);
104 104
105 for (int i = 0; i < length; i++) { 105 for (int i = 0; i < length; i++) {
106 WallpaperLayout layout = layouts[i]; 106 WallpaperLayout layout = layouts[i];
107 gfx::ImageSkia small_image(gfx::ImageSkiaRep(gfx::Size(10, 20), 1.0f)); 107 gfx::ImageSkia small_image(gfx::ImageSkiaRep(gfx::Size(10, 20),
108 ui::SCALE_FACTOR_100P));
108 109
109 gfx::ImageSkia resized_small = Resize(small_image, gfx::Size(800, 600), 110 gfx::ImageSkia resized_small = Resize(small_image, gfx::Size(800, 600),
110 layout); 111 layout);
111 EXPECT_EQ(10, resized_small.width()); 112 EXPECT_EQ(10, resized_small.width());
112 EXPECT_EQ(20, resized_small.height()); 113 EXPECT_EQ(20, resized_small.height());
113 114
114 gfx::ImageSkia large_image(gfx::ImageSkiaRep(gfx::Size(1000, 1000), 1.0f)); 115 gfx::ImageSkia large_image(gfx::ImageSkiaRep(gfx::Size(1000, 1000),
116 ui::SCALE_FACTOR_100P));
115 gfx::ImageSkia resized_large = Resize(large_image, gfx::Size(800, 600), 117 gfx::ImageSkia resized_large = Resize(large_image, gfx::Size(800, 600),
116 layout); 118 layout);
117 EXPECT_EQ(800, resized_large.width()); 119 EXPECT_EQ(800, resized_large.width());
118 EXPECT_EQ(600, resized_large.height()); 120 EXPECT_EQ(600, resized_large.height());
119 } 121 }
120 } 122 }
121 123
122 // Test for crbug.com/244629. "CENTER_CROPPED generates the same image as 124 // Test for crbug.com/244629. "CENTER_CROPPED generates the same image as
123 // STRETCH layout" 125 // STRETCH layout"
124 TEST_F(WallpaperResizerTest, AllLayoutDifferent) { 126 TEST_F(WallpaperResizerTest, AllLayoutDifferent) {
(...skipping 11 matching lines...) Expand all
136 gfx::ImageSkia tile = Resize(image, target_size, WALLPAPER_LAYOUT_TILE); 138 gfx::ImageSkia tile = Resize(image, target_size, WALLPAPER_LAYOUT_TILE);
137 139
138 EXPECT_TRUE(IsColor(center, kExpectedCenter)); 140 EXPECT_TRUE(IsColor(center, kExpectedCenter));
139 EXPECT_TRUE(IsColor(center_cropped, kExpectedCenterCropped)); 141 EXPECT_TRUE(IsColor(center_cropped, kExpectedCenterCropped));
140 EXPECT_TRUE(IsColor(stretch, kExpectedStretch)); 142 EXPECT_TRUE(IsColor(stretch, kExpectedStretch));
141 EXPECT_TRUE(IsColor(tile, kExpectedTile)); 143 EXPECT_TRUE(IsColor(tile, kExpectedTile));
142 } 144 }
143 145
144 } // namespace internal 146 } // namespace internal
145 } // namespace ash 147 } // namespace ash
OLDNEW
« no previous file with comments | « trunk/src/apps/shell_window.cc ('k') | trunk/src/ash/display/mirror_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698