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/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return image; | 101 return image; |
102 } | 102 } |
103 | 103 |
104 // Runs kAnimatingDesktopController's animation to completion. | 104 // Runs kAnimatingDesktopController's animation to completion. |
105 // TODO(bshe): Don't require tests to run animations; it's slow. | 105 // TODO(bshe): Don't require tests to run animations; it's slow. |
106 void RunDesktopControllerAnimation() { | 106 void RunDesktopControllerAnimation() { |
107 DesktopBackgroundWidgetController* controller = | 107 DesktopBackgroundWidgetController* controller = |
108 Shell::GetPrimaryRootWindowController() | 108 Shell::GetPrimaryRootWindowController() |
109 ->animating_wallpaper_controller() | 109 ->animating_wallpaper_controller() |
110 ->GetController(false); | 110 ->GetController(false); |
| 111 EXPECT_TRUE(!!controller); |
111 ASSERT_NO_FATAL_FAILURE(RunAnimationForWidget(controller->widget())); | 112 ASSERT_NO_FATAL_FAILURE(RunAnimationForWidget(controller->widget())); |
112 } | 113 } |
113 | 114 |
114 DesktopBackgroundController* controller_; // Not owned. | 115 DesktopBackgroundController* controller_; // Not owned. |
115 | 116 |
116 test::TestUserWallpaperDelegate* wallpaper_delegate_; | 117 test::TestUserWallpaperDelegate* wallpaper_delegate_; |
117 | 118 |
118 private: | 119 private: |
119 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundControllerTest); | 120 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundControllerTest); |
120 }; | 121 }; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 RunDesktopControllerAnimation(); | 173 RunDesktopControllerAnimation(); |
173 | 174 |
174 // Ownership has moved from kAnimatingDesktopController to kDesktopController. | 175 // Ownership has moved from kAnimatingDesktopController to kDesktopController. |
175 EXPECT_FALSE(root_window_controller->animating_wallpaper_controller()-> | 176 EXPECT_FALSE(root_window_controller->animating_wallpaper_controller()-> |
176 GetController(false)); | 177 GetController(false)); |
177 EXPECT_TRUE(root_window_controller->wallpaper_controller()); | 178 EXPECT_TRUE(root_window_controller->wallpaper_controller()); |
178 } | 179 } |
179 | 180 |
180 // Test for crbug.com/149043 "Unlock screen, no launcher appears". Ensure we | 181 // Test for crbug.com/149043 "Unlock screen, no launcher appears". Ensure we |
181 // move all desktop views if there are more than one. | 182 // move all desktop views if there are more than one. |
182 // Disabled for crbug.com/366993 | 183 TEST_F(DesktopBackgroundControllerTest, BackgroundMovementDuringUnlock) { |
183 TEST_F(DesktopBackgroundControllerTest, DISABLED_BackgroundMovementDuringUnlock)
{ | |
184 // We cannot short-circuit animations for this test. | 184 // We cannot short-circuit animations for this test. |
185 ui::ScopedAnimationDurationScaleMode normal_duration_mode( | 185 ui::ScopedAnimationDurationScaleMode normal_duration_mode( |
186 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); | 186 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); |
187 | 187 |
188 // Reset wallpaper state, see ControllerOwnership above. | 188 // Reset wallpaper state, see ControllerOwnership above. |
189 DesktopBackgroundController* controller = | 189 DesktopBackgroundController* controller = |
190 Shell::GetInstance()->desktop_background_controller(); | 190 Shell::GetInstance()->desktop_background_controller(); |
191 controller->CreateEmptyWallpaper(); | 191 controller->CreateEmptyWallpaper(); |
192 | 192 |
193 // Run wallpaper show animation to completion. | 193 // Run wallpaper show animation to completion. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 // Maximum width and height belongs to different displays. | 343 // Maximum width and height belongs to different displays. |
344 UpdateDisplay("400x300,100x500"); | 344 UpdateDisplay("400x300,100x500"); |
345 EXPECT_EQ( | 345 EXPECT_EQ( |
346 "400x500", | 346 "400x500", |
347 DesktopBackgroundController::GetMaxDisplaySizeInNative().ToString()); | 347 DesktopBackgroundController::GetMaxDisplaySizeInNative().ToString()); |
348 } | 348 } |
349 | 349 |
350 | 350 |
351 } // namespace ash | 351 } // namespace ash |
OLD | NEW |