OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wallpaper/wallpaper_controller.h" | 5 #include "ash/common/wallpaper/wallpaper_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 | 9 |
10 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| 11 #include "ash/common/wallpaper/wallpaper_view.h" |
| 12 #include "ash/common/wallpaper/wallpaper_widget_controller.h" |
| 13 #include "ash/common/wm_root_window_controller.h" |
11 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
12 #include "ash/root_window_controller.h" | 15 #include "ash/common/wm_window.h" |
13 #include "ash/shell.h" | |
14 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
15 #include "ash/test/test_wallpaper_delegate.h" | 17 #include "ash/test/test_wallpaper_delegate.h" |
16 #include "ash/wallpaper/wallpaper_view.h" | |
17 #include "ash/wallpaper/wallpaper_widget_controller.h" | |
18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
21 #include "base/threading/sequenced_worker_pool.h" | 21 #include "base/threading/sequenced_worker_pool.h" |
22 #include "third_party/skia/include/core/SkBitmap.h" | 22 #include "third_party/skia/include/core/SkBitmap.h" |
23 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
24 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 24 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
25 #include "ui/compositor/test/layer_animator_test_controller.h" | 25 #include "ui/compositor/test/layer_animator_test_controller.h" |
26 #include "ui/gfx/canvas.h" | 26 #include "ui/gfx/canvas.h" |
27 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
28 | 28 |
29 using wallpaper::WALLPAPER_LAYOUT_CENTER; | 29 using wallpaper::WALLPAPER_LAYOUT_CENTER; |
30 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; | 30 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; |
31 using wallpaper::WALLPAPER_LAYOUT_STRETCH; | 31 using wallpaper::WALLPAPER_LAYOUT_STRETCH; |
32 using wallpaper::WALLPAPER_LAYOUT_TILE; | 32 using wallpaper::WALLPAPER_LAYOUT_TILE; |
33 | 33 |
34 namespace ash { | 34 namespace ash { |
35 namespace { | 35 namespace { |
36 | 36 |
37 // Containers IDs used for tests. | 37 // Containers IDs used for tests. |
38 const int kWallpaperId = ash::kShellWindowId_WallpaperContainer; | 38 const int kWallpaperId = ash::kShellWindowId_WallpaperContainer; |
39 const int kLockScreenWallpaperId = | 39 const int kLockScreenWallpaperId = |
40 ash::kShellWindowId_LockScreenWallpaperContainer; | 40 ash::kShellWindowId_LockScreenWallpaperContainer; |
41 | 41 |
42 // Returns number of child windows in a shell window container. | 42 // Returns number of child windows in a shell window container. |
43 int ChildCountForContainer(int container_id) { | 43 int ChildCountForContainer(int container_id) { |
44 aura::Window* root = ash::Shell::GetPrimaryRootWindow(); | 44 WmWindow* root = WmShell::Get()->GetPrimaryRootWindow(); |
45 aura::Window* container = root->GetChildById(container_id); | 45 WmWindow* container = root->GetChildByShellWindowId(container_id); |
46 return static_cast<int>(container->children().size()); | 46 return static_cast<int>(container->GetChildren().size()); |
47 } | 47 } |
48 | 48 |
49 // Steps a widget's layer animation until it is completed. Animations must be | 49 // Steps a widget's layer animation until it is completed. Animations must be |
50 // enabled. | 50 // enabled. |
51 void RunAnimationForWidget(views::Widget* widget) { | 51 void RunAnimationForWidget(views::Widget* widget) { |
52 // Animations must be enabled for stepping to work. | 52 // Animations must be enabled for stepping to work. |
53 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), | 53 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), |
54 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); | 54 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); |
55 | 55 |
56 ui::Layer* layer = widget->GetNativeView()->layer(); | 56 ui::Layer* layer = widget->GetLayer(); |
57 ui::LayerAnimatorTestController controller(layer->GetAnimator()); | 57 ui::LayerAnimatorTestController controller(layer->GetAnimator()); |
58 // Multiple steps are required to complete complex animations. | 58 // Multiple steps are required to complete complex animations. |
59 // TODO(vollick): This should not be necessary. crbug.com/154017 | 59 // TODO(vollick): This should not be necessary. crbug.com/154017 |
60 while (controller.animator()->is_animating()) { | 60 while (controller.animator()->is_animating()) { |
61 controller.StartThreadedAnimationsIfNeeded(); | 61 controller.StartThreadedAnimationsIfNeeded(); |
62 base::TimeTicks step_time = controller.animator()->last_step_time(); | 62 base::TimeTicks step_time = controller.animator()->last_step_time(); |
63 layer->GetAnimator()->Step(step_time + | 63 layer->GetAnimator()->Step(step_time + |
64 base::TimeDelta::FromMilliseconds(1000)); | 64 base::TimeDelta::FromMilliseconds(1000)); |
65 } | 65 } |
66 } | 66 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 class WallpaperControllerTest : public test::AshTestBase { | 104 class WallpaperControllerTest : public test::AshTestBase { |
105 public: | 105 public: |
106 WallpaperControllerTest() | 106 WallpaperControllerTest() |
107 : controller_(nullptr), wallpaper_delegate_(nullptr) {} | 107 : controller_(nullptr), wallpaper_delegate_(nullptr) {} |
108 ~WallpaperControllerTest() override {} | 108 ~WallpaperControllerTest() override {} |
109 | 109 |
110 void SetUp() override { | 110 void SetUp() override { |
111 test::AshTestBase::SetUp(); | 111 test::AshTestBase::SetUp(); |
112 // Ash shell initialization creates wallpaper. Reset it so we can manually | 112 // Ash shell initialization creates wallpaper. Reset it so we can manually |
113 // control wallpaper creation and animation in our tests. | 113 // control wallpaper creation and animation in our tests. |
114 RootWindowController* root_window_controller = | 114 WmRootWindowController* root_window_controller = |
115 Shell::GetPrimaryRootWindowController(); | 115 WmShell::Get()->GetPrimaryRootWindow()->GetRootWindowController(); |
116 root_window_controller->SetWallpaperWidgetController(nullptr); | 116 root_window_controller->SetWallpaperWidgetController(nullptr); |
117 root_window_controller->SetAnimatingWallpaperWidgetController(nullptr); | 117 root_window_controller->SetAnimatingWallpaperWidgetController(nullptr); |
118 controller_ = Shell::GetInstance()->wallpaper_controller(); | 118 controller_ = WmShell::Get()->wallpaper_controller(); |
119 wallpaper_delegate_ = static_cast<test::TestWallpaperDelegate*>( | 119 wallpaper_delegate_ = static_cast<test::TestWallpaperDelegate*>( |
120 WmShell::Get()->wallpaper_delegate()); | 120 WmShell::Get()->wallpaper_delegate()); |
121 controller_->set_wallpaper_reload_delay_for_test(0); | 121 controller_->set_wallpaper_reload_delay_for_test(0); |
122 } | 122 } |
123 | 123 |
124 WallpaperView* wallpaper_view() { | 124 WallpaperView* wallpaper_view() { |
125 WallpaperWidgetController* controller = | 125 WallpaperWidgetController* controller = |
126 Shell::GetPrimaryRootWindowController() | 126 WmShell::Get() |
| 127 ->GetPrimaryRootWindow() |
| 128 ->GetRootWindowController() |
127 ->animating_wallpaper_widget_controller() | 129 ->animating_wallpaper_widget_controller() |
128 ->GetController(false); | 130 ->GetController(false); |
129 EXPECT_TRUE(controller); | 131 EXPECT_TRUE(controller); |
130 return static_cast<WallpaperView*>( | 132 return static_cast<WallpaperView*>( |
131 controller->widget()->GetContentsView()->child_at(0)); | 133 controller->widget()->GetContentsView()->child_at(0)); |
132 } | 134 } |
133 | 135 |
134 protected: | 136 protected: |
135 // A color that can be passed to CreateImage(). Specifically chosen to not | 137 // A color that can be passed to CreateImage(). Specifically chosen to not |
136 // conflict with any of the default wallpaper colors. | 138 // conflict with any of the default wallpaper colors. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 EXPECT_EQ(SK_ColorBLACK, bitmap.getColor(i, j)); | 175 EXPECT_EQ(SK_ColorBLACK, bitmap.getColor(i, j)); |
174 } | 176 } |
175 } | 177 } |
176 } | 178 } |
177 } | 179 } |
178 | 180 |
179 // Runs AnimatingWallpaperWidgetController's animation to completion. | 181 // Runs AnimatingWallpaperWidgetController's animation to completion. |
180 // TODO(bshe): Don't require tests to run animations; it's slow. | 182 // TODO(bshe): Don't require tests to run animations; it's slow. |
181 void RunDesktopControllerAnimation() { | 183 void RunDesktopControllerAnimation() { |
182 WallpaperWidgetController* controller = | 184 WallpaperWidgetController* controller = |
183 Shell::GetPrimaryRootWindowController() | 185 WmShell::Get() |
| 186 ->GetPrimaryRootWindow() |
| 187 ->GetRootWindowController() |
184 ->animating_wallpaper_widget_controller() | 188 ->animating_wallpaper_widget_controller() |
185 ->GetController(false); | 189 ->GetController(false); |
186 EXPECT_TRUE(controller); | 190 EXPECT_TRUE(controller); |
187 ASSERT_NO_FATAL_FAILURE(RunAnimationForWidget(controller->widget())); | 191 ASSERT_NO_FATAL_FAILURE(RunAnimationForWidget(controller->widget())); |
188 } | 192 } |
189 | 193 |
190 WallpaperController* controller_; // Not owned. | 194 WallpaperController* controller_; // Not owned. |
191 | 195 |
192 test::TestWallpaperDelegate* wallpaper_delegate_; | 196 test::TestWallpaperDelegate* wallpaper_delegate_; |
193 | 197 |
194 private: | 198 private: |
195 DISALLOW_COPY_AND_ASSIGN(WallpaperControllerTest); | 199 DISALLOW_COPY_AND_ASSIGN(WallpaperControllerTest); |
196 }; | 200 }; |
197 | 201 |
198 TEST_F(WallpaperControllerTest, BasicReparenting) { | 202 TEST_F(WallpaperControllerTest, BasicReparenting) { |
199 WallpaperController* controller = | 203 WallpaperController* controller = WmShell::Get()->wallpaper_controller(); |
200 Shell::GetInstance()->wallpaper_controller(); | |
201 controller->CreateEmptyWallpaper(); | 204 controller->CreateEmptyWallpaper(); |
202 | 205 |
203 // Wallpaper view/window exists in the wallpaper container and nothing is in | 206 // Wallpaper view/window exists in the wallpaper container and nothing is in |
204 // the lock screen wallpaper container. | 207 // the lock screen wallpaper container. |
205 EXPECT_EQ(1, ChildCountForContainer(kWallpaperId)); | 208 EXPECT_EQ(1, ChildCountForContainer(kWallpaperId)); |
206 EXPECT_EQ(0, ChildCountForContainer(kLockScreenWallpaperId)); | 209 EXPECT_EQ(0, ChildCountForContainer(kLockScreenWallpaperId)); |
207 | 210 |
208 // Moving wallpaper to lock container should succeed the first time but | 211 // Moving wallpaper to lock container should succeed the first time but |
209 // subsequent calls should do nothing. | 212 // subsequent calls should do nothing. |
210 EXPECT_TRUE(controller->MoveToLockedContainer()); | 213 EXPECT_TRUE(controller->MoveToLockedContainer()); |
(...skipping 11 matching lines...) Expand all Loading... |
222 EXPECT_EQ(1, ChildCountForContainer(kWallpaperId)); | 225 EXPECT_EQ(1, ChildCountForContainer(kWallpaperId)); |
223 EXPECT_EQ(0, ChildCountForContainer(kLockScreenWallpaperId)); | 226 EXPECT_EQ(0, ChildCountForContainer(kLockScreenWallpaperId)); |
224 } | 227 } |
225 | 228 |
226 TEST_F(WallpaperControllerTest, ControllerOwnership) { | 229 TEST_F(WallpaperControllerTest, ControllerOwnership) { |
227 // We cannot short-circuit animations for this test. | 230 // We cannot short-circuit animations for this test. |
228 ui::ScopedAnimationDurationScaleMode test_duration_mode( | 231 ui::ScopedAnimationDurationScaleMode test_duration_mode( |
229 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); | 232 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); |
230 | 233 |
231 // Create the wallpaper and its view. | 234 // Create the wallpaper and its view. |
232 WallpaperController* controller = | 235 WallpaperController* controller = WmShell::Get()->wallpaper_controller(); |
233 Shell::GetInstance()->wallpaper_controller(); | |
234 controller->CreateEmptyWallpaper(); | 236 controller->CreateEmptyWallpaper(); |
235 | 237 |
236 // The new wallpaper is ready to animate. | 238 // The new wallpaper is ready to animate. |
237 RootWindowController* root_window_controller = | 239 WmRootWindowController* root_window_controller = |
238 Shell::GetPrimaryRootWindowController(); | 240 WmShell::Get()->GetPrimaryRootWindow()->GetRootWindowController(); |
239 EXPECT_TRUE(root_window_controller->animating_wallpaper_widget_controller() | 241 EXPECT_TRUE(root_window_controller->animating_wallpaper_widget_controller() |
240 ->GetController(false)); | 242 ->GetController(false)); |
241 EXPECT_FALSE(root_window_controller->wallpaper_widget_controller()); | 243 EXPECT_FALSE(root_window_controller->wallpaper_widget_controller()); |
242 | 244 |
243 // Force the animation to play to completion. | 245 // Force the animation to play to completion. |
244 RunDesktopControllerAnimation(); | 246 RunDesktopControllerAnimation(); |
245 EXPECT_FALSE(root_window_controller->animating_wallpaper_widget_controller() | 247 EXPECT_FALSE(root_window_controller->animating_wallpaper_widget_controller() |
246 ->GetController(false)); | 248 ->GetController(false)); |
247 EXPECT_TRUE(root_window_controller->wallpaper_widget_controller()); | 249 EXPECT_TRUE(root_window_controller->wallpaper_widget_controller()); |
248 } | 250 } |
249 | 251 |
250 // Test for crbug.com/149043 "Unlock screen, no launcher appears". Ensure we | 252 // Test for crbug.com/149043 "Unlock screen, no launcher appears". Ensure we |
251 // move all wallpaper views if there are more than one. | 253 // move all wallpaper views if there are more than one. |
252 TEST_F(WallpaperControllerTest, WallpaperMovementDuringUnlock) { | 254 TEST_F(WallpaperControllerTest, WallpaperMovementDuringUnlock) { |
253 // We cannot short-circuit animations for this test. | 255 // We cannot short-circuit animations for this test. |
254 ui::ScopedAnimationDurationScaleMode test_duration_mode( | 256 ui::ScopedAnimationDurationScaleMode test_duration_mode( |
255 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); | 257 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); |
256 | 258 |
257 // Reset wallpaper state, see ControllerOwnership above. | 259 // Reset wallpaper state, see ControllerOwnership above. |
258 WallpaperController* controller = | 260 WallpaperController* controller = WmShell::Get()->wallpaper_controller(); |
259 Shell::GetInstance()->wallpaper_controller(); | |
260 controller->CreateEmptyWallpaper(); | 261 controller->CreateEmptyWallpaper(); |
261 | 262 |
262 // Run wallpaper show animation to completion. | 263 // Run wallpaper show animation to completion. |
263 RunDesktopControllerAnimation(); | 264 RunDesktopControllerAnimation(); |
264 | 265 |
265 // User locks the screen, which moves the wallpaper forward. | 266 // User locks the screen, which moves the wallpaper forward. |
266 controller->MoveToLockedContainer(); | 267 controller->MoveToLockedContainer(); |
267 | 268 |
268 // Suspend/resume cycle causes wallpaper to refresh, loading a new wallpaper | 269 // Suspend/resume cycle causes wallpaper to refresh, loading a new wallpaper |
269 // that will animate in on top of the old one. | 270 // that will animate in on top of the old one. |
270 controller->CreateEmptyWallpaper(); | 271 controller->CreateEmptyWallpaper(); |
271 | 272 |
272 // In this state we have two wallpaper views stored in different properties. | 273 // In this state we have two wallpaper views stored in different properties. |
273 // Both are in the lock screen wallpaper container. | 274 // Both are in the lock screen wallpaper container. |
274 RootWindowController* root_window_controller = | 275 WmRootWindowController* root_window_controller = |
275 Shell::GetPrimaryRootWindowController(); | 276 WmShell::Get()->GetPrimaryRootWindow()->GetRootWindowController(); |
276 EXPECT_TRUE(root_window_controller->animating_wallpaper_widget_controller() | 277 EXPECT_TRUE(root_window_controller->animating_wallpaper_widget_controller() |
277 ->GetController(false)); | 278 ->GetController(false)); |
278 EXPECT_TRUE(root_window_controller->wallpaper_widget_controller()); | 279 EXPECT_TRUE(root_window_controller->wallpaper_widget_controller()); |
279 EXPECT_EQ(0, ChildCountForContainer(kWallpaperId)); | 280 EXPECT_EQ(0, ChildCountForContainer(kWallpaperId)); |
280 EXPECT_EQ(2, ChildCountForContainer(kLockScreenWallpaperId)); | 281 EXPECT_EQ(2, ChildCountForContainer(kLockScreenWallpaperId)); |
281 | 282 |
282 // Before the wallpaper's animation completes, user unlocks the screen, which | 283 // Before the wallpaper's animation completes, user unlocks the screen, which |
283 // moves the wallpaper to the back. | 284 // moves the wallpaper to the back. |
284 controller->MoveToUnlockedContainer(); | 285 controller->MoveToUnlockedContainer(); |
285 | 286 |
(...skipping 10 matching lines...) Expand all Loading... |
296 } | 297 } |
297 | 298 |
298 // Test for crbug.com/156542. Animating wallpaper should immediately finish | 299 // Test for crbug.com/156542. Animating wallpaper should immediately finish |
299 // animation and replace current wallpaper before next animation starts. | 300 // animation and replace current wallpaper before next animation starts. |
300 TEST_F(WallpaperControllerTest, ChangeWallpaperQuick) { | 301 TEST_F(WallpaperControllerTest, ChangeWallpaperQuick) { |
301 // We cannot short-circuit animations for this test. | 302 // We cannot short-circuit animations for this test. |
302 ui::ScopedAnimationDurationScaleMode test_duration_mode( | 303 ui::ScopedAnimationDurationScaleMode test_duration_mode( |
303 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); | 304 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); |
304 | 305 |
305 // Reset wallpaper state, see ControllerOwnership above. | 306 // Reset wallpaper state, see ControllerOwnership above. |
306 WallpaperController* controller = | 307 WallpaperController* controller = WmShell::Get()->wallpaper_controller(); |
307 Shell::GetInstance()->wallpaper_controller(); | |
308 controller->CreateEmptyWallpaper(); | 308 controller->CreateEmptyWallpaper(); |
309 | 309 |
310 // Run wallpaper show animation to completion. | 310 // Run wallpaper show animation to completion. |
311 RunDesktopControllerAnimation(); | 311 RunDesktopControllerAnimation(); |
312 | 312 |
313 // Change to a new wallpaper. | 313 // Change to a new wallpaper. |
314 controller->CreateEmptyWallpaper(); | 314 controller->CreateEmptyWallpaper(); |
315 | 315 |
316 RootWindowController* root_window_controller = | 316 WmRootWindowController* root_window_controller = |
317 Shell::GetPrimaryRootWindowController(); | 317 WmShell::Get()->GetPrimaryRootWindow()->GetRootWindowController(); |
318 WallpaperWidgetController* animating_controller = | 318 WallpaperWidgetController* animating_controller = |
319 root_window_controller->animating_wallpaper_widget_controller() | 319 root_window_controller->animating_wallpaper_widget_controller() |
320 ->GetController(false); | 320 ->GetController(false); |
321 EXPECT_TRUE(animating_controller); | 321 EXPECT_TRUE(animating_controller); |
322 EXPECT_TRUE(root_window_controller->wallpaper_widget_controller()); | 322 EXPECT_TRUE(root_window_controller->wallpaper_widget_controller()); |
323 | 323 |
324 // Change to another wallpaper before animation finished. | 324 // Change to another wallpaper before animation finished. |
325 controller->CreateEmptyWallpaper(); | 325 controller->CreateEmptyWallpaper(); |
326 | 326 |
327 // The animating controller should immediately move to wallpaper controller. | 327 // The animating controller should immediately move to wallpaper controller. |
(...skipping 24 matching lines...) Expand all Loading... |
352 return; | 352 return; |
353 | 353 |
354 UpdateDisplay("320x200"); | 354 UpdateDisplay("320x200"); |
355 | 355 |
356 gfx::ImageSkia image = CreateImage(640, 480, kCustomWallpaperColor); | 356 gfx::ImageSkia image = CreateImage(640, 480, kCustomWallpaperColor); |
357 | 357 |
358 // Set the image as custom wallpaper, wait for the resize to finish, and check | 358 // Set the image as custom wallpaper, wait for the resize to finish, and check |
359 // that the resized image is the expected size. | 359 // that the resized image is the expected size. |
360 controller_->SetWallpaperImage(image, WALLPAPER_LAYOUT_STRETCH); | 360 controller_->SetWallpaperImage(image, WALLPAPER_LAYOUT_STRETCH); |
361 EXPECT_TRUE(image.BackedBySameObjectAs(controller_->GetWallpaper())); | 361 EXPECT_TRUE(image.BackedBySameObjectAs(controller_->GetWallpaper())); |
362 RunAllBlockingPoolTasksUntilIdle(Shell::GetInstance()->blocking_pool()); | 362 RunAllBlockingPoolTasksUntilIdle(WmShell::Get()->blocking_pool().get()); |
363 gfx::ImageSkia resized_image = controller_->GetWallpaper(); | 363 gfx::ImageSkia resized_image = controller_->GetWallpaper(); |
364 EXPECT_FALSE(image.BackedBySameObjectAs(resized_image)); | 364 EXPECT_FALSE(image.BackedBySameObjectAs(resized_image)); |
365 EXPECT_EQ(gfx::Size(320, 200).ToString(), resized_image.size().ToString()); | 365 EXPECT_EQ(gfx::Size(320, 200).ToString(), resized_image.size().ToString()); |
366 | 366 |
367 // Load the original wallpaper again and check that we're still using the | 367 // Load the original wallpaper again and check that we're still using the |
368 // previously-resized image instead of doing another resize | 368 // previously-resized image instead of doing another resize |
369 // (http://crbug.com/321402). | 369 // (http://crbug.com/321402). |
370 controller_->SetWallpaperImage(image, WALLPAPER_LAYOUT_STRETCH); | 370 controller_->SetWallpaperImage(image, WALLPAPER_LAYOUT_STRETCH); |
371 RunAllBlockingPoolTasksUntilIdle(Shell::GetInstance()->blocking_pool()); | 371 RunAllBlockingPoolTasksUntilIdle(WmShell::Get()->blocking_pool().get()); |
372 EXPECT_TRUE(resized_image.BackedBySameObjectAs(controller_->GetWallpaper())); | 372 EXPECT_TRUE(resized_image.BackedBySameObjectAs(controller_->GetWallpaper())); |
373 } | 373 } |
374 | 374 |
375 #if defined(OS_WIN) && !defined(USE_ASH) | 375 #if defined(OS_WIN) && !defined(USE_ASH) |
376 // TODO(msw): Broken on Windows. http://crbug.com/584038 | 376 // TODO(msw): Broken on Windows. http://crbug.com/584038 |
377 #define MAYBE_GetMaxDisplaySize DISABLED_GetMaxDisplaySize | 377 #define MAYBE_GetMaxDisplaySize DISABLED_GetMaxDisplaySize |
378 #else | 378 #else |
379 #define MAYBE_GetMaxDisplaySize GetMaxDisplaySize | 379 #define MAYBE_GetMaxDisplaySize GetMaxDisplaySize |
380 #endif | 380 #endif |
381 TEST_F(WallpaperControllerTest, MAYBE_GetMaxDisplaySize) { | 381 TEST_F(WallpaperControllerTest, MAYBE_GetMaxDisplaySize) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 { | 473 { |
474 SCOPED_TRACE(base::StringPrintf("1200x600/u@1.5 low resolution")); | 474 SCOPED_TRACE(base::StringPrintf("1200x600/u@1.5 low resolution")); |
475 controller_->SetWallpaperImage(image_low_res, WALLPAPER_LAYOUT_CENTER); | 475 controller_->SetWallpaperImage(image_low_res, WALLPAPER_LAYOUT_CENTER); |
476 WallpaperFitToNativeResolution( | 476 WallpaperFitToNativeResolution( |
477 wallpaper_view(), low_dsf, low_resolution.width(), | 477 wallpaper_view(), low_dsf, low_resolution.width(), |
478 low_resolution.height(), kCustomWallpaperColor); | 478 low_resolution.height(), kCustomWallpaperColor); |
479 } | 479 } |
480 } | 480 } |
481 | 481 |
482 } // namespace ash | 482 } // namespace ash |
OLD | NEW |