OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 5 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
6 | 6 |
7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
8 #include "ash/desktop_background/desktop_background_controller_observer.h" | 8 #include "ash/desktop_background/desktop_background_controller_observer.h" |
9 #include "ash/desktop_background/desktop_background_controller_test_api.h" | 9 #include "ash/desktop_background/desktop_background_controller_test_api.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
23 #include "base/prefs/scoped_user_pref_update.h" | 23 #include "base/prefs/scoped_user_pref_update.h" |
24 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
26 #include "base/values.h" | 26 #include "base/values.h" |
27 #include "chrome/browser/chromeos/login/users/user.h" | 27 #include "chrome/browser/chromeos/login/users/user.h" |
28 #include "chrome/browser/chromeos/login/users/user_manager.h" | 28 #include "chrome/browser/chromeos/login/users/user_manager.h" |
29 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_u
tils.h" | 29 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_u
tils.h" |
30 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
31 #include "chrome/common/chrome_switches.h" | |
32 #include "chrome/test/base/in_process_browser_test.h" | 31 #include "chrome/test/base/in_process_browser_test.h" |
33 #include "chrome/test/base/testing_browser_process.h" | 32 #include "chrome/test/base/testing_browser_process.h" |
34 #include "chromeos/chromeos_switches.h" | 33 #include "chromeos/chromeos_switches.h" |
35 #include "content/public/test/test_utils.h" | 34 #include "content/public/test/test_utils.h" |
36 #include "ui/aura/env.h" | 35 #include "ui/aura/env.h" |
37 #include "ui/gfx/image/image_skia.h" | 36 #include "ui/gfx/image/image_skia.h" |
38 #include "ui/gfx/point.h" | 37 #include "ui/gfx/point.h" |
39 #include "ui/gfx/rect.h" | 38 #include "ui/gfx/rect.h" |
40 | 39 |
41 using namespace ash; | 40 using namespace ash; |
42 | 41 |
43 namespace chromeos { | 42 namespace chromeos { |
44 | 43 |
45 namespace { | 44 namespace { |
46 | 45 |
47 int kLargeWallpaperWidth = 256; | 46 int kLargeWallpaperWidth = 256; |
48 int kLargeWallpaperHeight = chromeos::kLargeWallpaperMaxHeight; | 47 int kLargeWallpaperHeight = chromeos::kLargeWallpaperMaxHeight; |
49 int kSmallWallpaperWidth = 256; | 48 int kSmallWallpaperWidth = 256; |
50 int kSmallWallpaperHeight = chromeos::kSmallWallpaperMaxHeight; | 49 int kSmallWallpaperHeight = chromeos::kSmallWallpaperMaxHeight; |
51 | 50 |
52 const char kTestUser1[] = "test1@domain.com"; | 51 const char kTestUser1[] = "test1@domain.com"; |
53 const char kTestUser1Hash[] = "test1@domain.com-hash"; | 52 const char kTestUser1Hash[] = "test1@domain.com-hash"; |
54 const char kTestUser2[] = "test2@domain.com"; | 53 const char kTestUser2[] = "test2@domain.com"; |
55 const char kTestUser2Hash[] = "test2@domain.com-hash"; | 54 const char kTestUser2Hash[] = "test2@domain.com-hash"; |
56 | 55 |
57 } // namespace | 56 } // namespace |
58 | 57 |
59 class WallpaperManagerBrowserTest : public InProcessBrowserTest, | 58 class WallpaperManagerBrowserTest : public InProcessBrowserTest { |
60 public testing::WithParamInterface<bool> { | |
61 public: | 59 public: |
62 WallpaperManagerBrowserTest () : controller_(NULL), | 60 WallpaperManagerBrowserTest () : controller_(NULL), |
63 local_state_(NULL) { | 61 local_state_(NULL) { |
64 } | 62 } |
65 | 63 |
66 virtual ~WallpaperManagerBrowserTest () {} | 64 virtual ~WallpaperManagerBrowserTest () {} |
67 | 65 |
68 virtual void SetUpOnMainThread() OVERRIDE { | 66 virtual void SetUpOnMainThread() OVERRIDE { |
69 controller_ = ash::Shell::GetInstance()->desktop_background_controller(); | 67 controller_ = ash::Shell::GetInstance()->desktop_background_controller(); |
70 local_state_ = g_browser_process->local_state(); | 68 local_state_ = g_browser_process->local_state(); |
71 DesktopBackgroundController::TestAPI(controller_) | 69 DesktopBackgroundController::TestAPI(controller_) |
72 .set_wallpaper_reload_delay_for_test(0); | 70 .set_wallpaper_reload_delay_for_test(0); |
73 UpdateDisplay("800x600"); | 71 UpdateDisplay("800x600"); |
74 } | 72 } |
75 | 73 |
76 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 74 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
77 command_line->AppendSwitch(switches::kLoginManager); | 75 command_line->AppendSwitch(switches::kLoginManager); |
78 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 76 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
79 if (GetParam()) | |
80 command_line->AppendSwitch(::switches::kMultiProfiles); | |
81 } | 77 } |
82 | 78 |
83 virtual void CleanUpOnMainThread() OVERRIDE { | 79 virtual void CleanUpOnMainThread() OVERRIDE { |
84 controller_ = NULL; | 80 controller_ = NULL; |
85 } | 81 } |
86 | 82 |
87 // Update the display configuration as given in |display_specs|. See | 83 // Update the display configuration as given in |display_specs|. See |
88 // ash::test::DisplayManagerTestApi::UpdateDisplay for more details. | 84 // ash::test::DisplayManagerTestApi::UpdateDisplay for more details. |
89 void UpdateDisplay(const std::string& display_specs) { | 85 void UpdateDisplay(const std::string& display_specs) { |
90 ash::test::DisplayManagerTestApi display_manager_test_api( | 86 ash::test::DisplayManagerTestApi display_manager_test_api( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // Directory created by CreateCmdlineWallpapers () to store default | 140 // Directory created by CreateCmdlineWallpapers () to store default |
145 // wallpaper images. | 141 // wallpaper images. |
146 scoped_ptr<base::ScopedTempDir> wallpaper_dir_; | 142 scoped_ptr<base::ScopedTempDir> wallpaper_dir_; |
147 | 143 |
148 private: | 144 private: |
149 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerBrowserTest); | 145 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerBrowserTest); |
150 }; | 146 }; |
151 | 147 |
152 // Tests that the appropriate custom wallpaper (large vs. small) is loaded | 148 // Tests that the appropriate custom wallpaper (large vs. small) is loaded |
153 // depending on the desktop resolution. | 149 // depending on the desktop resolution. |
154 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, | 150 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, |
155 LoadCustomLargeWallpaperForLargeExternalScreen) { | 151 LoadCustomLargeWallpaperForLargeExternalScreen) { |
156 WallpaperManager* wallpaper_manager = WallpaperManager::Get(); | 152 WallpaperManager* wallpaper_manager = WallpaperManager::Get(); |
157 LogIn(kTestUser1, kTestUser1Hash); | 153 LogIn(kTestUser1, kTestUser1Hash); |
158 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); | 154 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); |
159 base::FilePath small_wallpaper_path = GetCustomWallpaperPath( | 155 base::FilePath small_wallpaper_path = GetCustomWallpaperPath( |
160 kSmallWallpaperSubDir, | 156 kSmallWallpaperSubDir, |
161 kTestUser1Hash, | 157 kTestUser1Hash, |
162 id); | 158 id); |
163 base::FilePath large_wallpaper_path = GetCustomWallpaperPath( | 159 base::FilePath large_wallpaper_path = GetCustomWallpaperPath( |
164 kLargeWallpaperSubDir, | 160 kLargeWallpaperSubDir, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 wallpaper = controller_->GetWallpaper(); | 222 wallpaper = controller_->GetWallpaper(); |
227 | 223 |
228 // The large resolution custom wallpaper is expected. | 224 // The large resolution custom wallpaper is expected. |
229 EXPECT_EQ(kLargeWallpaperWidth, wallpaper.width()); | 225 EXPECT_EQ(kLargeWallpaperWidth, wallpaper.width()); |
230 EXPECT_EQ(kLargeWallpaperHeight, wallpaper.height()); | 226 EXPECT_EQ(kLargeWallpaperHeight, wallpaper.height()); |
231 } | 227 } |
232 | 228 |
233 // If chrome tries to reload the same wallpaper twice, the latter request should | 229 // If chrome tries to reload the same wallpaper twice, the latter request should |
234 // be prevented. Otherwise, there are some strange animation issues as | 230 // be prevented. Otherwise, there are some strange animation issues as |
235 // described in crbug.com/158383. | 231 // described in crbug.com/158383. |
236 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, | 232 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, |
237 PreventReloadingSameWallpaper) { | 233 PreventReloadingSameWallpaper) { |
238 WallpaperManager* wallpaper_manager = WallpaperManager::Get(); | 234 WallpaperManager* wallpaper_manager = WallpaperManager::Get(); |
239 // New user log in, a default wallpaper is loaded. | 235 // New user log in, a default wallpaper is loaded. |
240 LogIn(kTestUser1, kTestUser1Hash); | 236 LogIn(kTestUser1, kTestUser1Hash); |
241 EXPECT_EQ(1, LoadedWallpapers()); | 237 EXPECT_EQ(1, LoadedWallpapers()); |
242 // Loads the same wallpaper before the initial one finished. It should be | 238 // Loads the same wallpaper before the initial one finished. It should be |
243 // prevented. | 239 // prevented. |
244 wallpaper_manager->SetUserWallpaperNow(kTestUser1); | 240 wallpaper_manager->SetUserWallpaperNow(kTestUser1); |
245 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 241 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
246 EXPECT_EQ(1, LoadedWallpapers()); | 242 EXPECT_EQ(1, LoadedWallpapers()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 EXPECT_EQ(2, LoadedWallpapers()); | 279 EXPECT_EQ(2, LoadedWallpapers()); |
284 wallpaper_manager->SetUserWallpaperNow(kTestUser1); | 280 wallpaper_manager->SetUserWallpaperNow(kTestUser1); |
285 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 281 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
286 EXPECT_EQ(2, LoadedWallpapers()); | 282 EXPECT_EQ(2, LoadedWallpapers()); |
287 } | 283 } |
288 | 284 |
289 // Some users have old user profiles which may have legacy wallpapers. And these | 285 // Some users have old user profiles which may have legacy wallpapers. And these |
290 // lagacy wallpapers should migrate to new wallpaper picker version seamlessly. | 286 // lagacy wallpapers should migrate to new wallpaper picker version seamlessly. |
291 // This tests make sure we compatible with migrated old wallpapers. | 287 // This tests make sure we compatible with migrated old wallpapers. |
292 // crosbug.com/38429 | 288 // crosbug.com/38429 |
293 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, | 289 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, |
294 PRE_UseMigratedWallpaperInfo) { | 290 PRE_UseMigratedWallpaperInfo) { |
295 // New user log in, a default wallpaper is loaded. | 291 // New user log in, a default wallpaper is loaded. |
296 LogIn(kTestUser1, kTestUser1Hash); | 292 LogIn(kTestUser1, kTestUser1Hash); |
297 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user | 293 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user |
298 // wallpaper info directly to simulate the wallpaper migration. See | 294 // wallpaper info directly to simulate the wallpaper migration. See |
299 // crosbug.com/38429 for details about why we modify wallpaper info this way. | 295 // crosbug.com/38429 for details about why we modify wallpaper info this way. |
300 WallpaperInfo info = { | 296 WallpaperInfo info = { |
301 "123", | 297 "123", |
302 WALLPAPER_LAYOUT_CENTER_CROPPED, | 298 WALLPAPER_LAYOUT_CENTER_CROPPED, |
303 User::DEFAULT, | 299 User::DEFAULT, |
304 base::Time::Now().LocalMidnight() | 300 base::Time::Now().LocalMidnight() |
305 }; | 301 }; |
306 base::FilePath user_data_dir; | 302 base::FilePath user_data_dir; |
307 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); | 303 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); |
308 ASSERT_TRUE(wallpaper_manager_test_utils::WriteJPEGFile( | 304 ASSERT_TRUE(wallpaper_manager_test_utils::WriteJPEGFile( |
309 user_data_dir.Append("123"), | 305 user_data_dir.Append("123"), |
310 wallpaper_manager_test_utils::kWallpaperSize, | 306 wallpaper_manager_test_utils::kWallpaperSize, |
311 wallpaper_manager_test_utils::kWallpaperSize, | 307 wallpaper_manager_test_utils::kWallpaperSize, |
312 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor)); | 308 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor)); |
313 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true); | 309 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true); |
314 } | 310 } |
315 | 311 |
316 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, | 312 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, |
317 UseMigratedWallpaperInfo) { | 313 UseMigratedWallpaperInfo) { |
318 LogIn(kTestUser1, kTestUser1Hash); | 314 LogIn(kTestUser1, kTestUser1Hash); |
319 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 315 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
320 // This test should finish normally. If timeout, it is probably because | 316 // This test should finish normally. If timeout, it is probably because |
321 // migrated wallpaper is somehow not loaded. Bad things can happen if | 317 // migrated wallpaper is somehow not loaded. Bad things can happen if |
322 // wallpaper is not loaded at login screen. One example is: crosbug.com/38429. | 318 // wallpaper is not loaded at login screen. One example is: crosbug.com/38429. |
323 } | 319 } |
324 | 320 |
325 // Some users have old user profiles which may never get a chance to migrate. | 321 // Some users have old user profiles which may never get a chance to migrate. |
326 // This tests make sure we compatible with these profiles. | 322 // This tests make sure we compatible with these profiles. |
327 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, | 323 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, |
328 PRE_UsePreMigrationWallpaperInfo) { | 324 PRE_UsePreMigrationWallpaperInfo) { |
329 // New user log in, a default wallpaper is loaded. | 325 // New user log in, a default wallpaper is loaded. |
330 LogIn(kTestUser1, kTestUser1Hash); | 326 LogIn(kTestUser1, kTestUser1Hash); |
331 // Old wallpaper migration code doesn't exist in codebase anymore. So if | 327 // Old wallpaper migration code doesn't exist in codebase anymore. So if |
332 // user's profile is not migrated, it is the same as no wallpaper info. To | 328 // user's profile is not migrated, it is the same as no wallpaper info. To |
333 // simulate this, we remove user's wallpaper info here. | 329 // simulate this, we remove user's wallpaper info here. |
334 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1); | 330 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1); |
335 } | 331 } |
336 | 332 |
337 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, | 333 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, |
338 UsePreMigrationWallpaperInfo) { | 334 UsePreMigrationWallpaperInfo) { |
339 LogIn(kTestUser1, kTestUser1Hash); | 335 LogIn(kTestUser1, kTestUser1Hash); |
340 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 336 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
341 // This test should finish normally. If timeout, it is probably because chrome | 337 // This test should finish normally. If timeout, it is probably because chrome |
342 // can not handle pre migrated user profile (M21 profile or older). | 338 // can not handle pre migrated user profile (M21 profile or older). |
343 } | 339 } |
344 | 340 |
345 // Test for http://crbug.com/265689. When hooked up a large external monitor, | 341 // Test for http://crbug.com/265689. When hooked up a large external monitor, |
346 // the default large resolution wallpaper should load. | 342 // the default large resolution wallpaper should load. |
347 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, | 343 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, |
348 HotPlugInScreenAtGAIALoginScreen) { | 344 HotPlugInScreenAtGAIALoginScreen) { |
349 UpdateDisplay("800x600"); | 345 UpdateDisplay("800x600"); |
350 // Set initial wallpaper to the default wallpaper. | 346 // Set initial wallpaper to the default wallpaper. |
351 WallpaperManager::Get()->SetDefaultWallpaperNow(UserManager::kStubUser); | 347 WallpaperManager::Get()->SetDefaultWallpaperNow(UserManager::kStubUser); |
352 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 348 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
353 | 349 |
354 // Hook up a 2000x2000 display. The large resolution custom wallpaper should | 350 // Hook up a 2000x2000 display. The large resolution custom wallpaper should |
355 // be loaded. | 351 // be loaded. |
356 UpdateDisplay("800x600,2000x2000"); | 352 UpdateDisplay("800x600,2000x2000"); |
357 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 353 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
358 } | 354 } |
359 | 355 |
360 class WallpaperManagerBrowserTestNoAnimation | 356 class WallpaperManagerBrowserTestNoAnimation |
361 : public WallpaperManagerBrowserTest { | 357 : public WallpaperManagerBrowserTest { |
362 public: | 358 public: |
363 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 359 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
364 command_line->AppendSwitch(switches::kLoginManager); | 360 command_line->AppendSwitch(switches::kLoginManager); |
365 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 361 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
366 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); | 362 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); |
367 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); | 363 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); |
368 } | 364 } |
369 }; | 365 }; |
370 | 366 |
371 // Same test as WallpaperManagerBrowserTest.UseMigratedWallpaperInfo. But | 367 // Same test as WallpaperManagerBrowserTest.UseMigratedWallpaperInfo. But |
372 // disabled boot and login animation. | 368 // disabled boot and login animation. |
373 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTestNoAnimation, | 369 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, |
374 PRE_UseMigratedWallpaperInfo) { | 370 PRE_UseMigratedWallpaperInfo) { |
375 // New user log in, a default wallpaper is loaded. | 371 // New user log in, a default wallpaper is loaded. |
376 LogIn(kTestUser1, kTestUser1Hash); | 372 LogIn(kTestUser1, kTestUser1Hash); |
377 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user | 373 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user |
378 // wallpaper info directly to simulate the wallpaper migration. See | 374 // wallpaper info directly to simulate the wallpaper migration. See |
379 // crosbug.com/38429 for details about why we modify wallpaper info this way. | 375 // crosbug.com/38429 for details about why we modify wallpaper info this way. |
380 WallpaperInfo info = { | 376 WallpaperInfo info = { |
381 "123", | 377 "123", |
382 WALLPAPER_LAYOUT_CENTER_CROPPED, | 378 WALLPAPER_LAYOUT_CENTER_CROPPED, |
383 User::DEFAULT, | 379 User::DEFAULT, |
384 base::Time::Now().LocalMidnight() | 380 base::Time::Now().LocalMidnight() |
385 }; | 381 }; |
386 base::FilePath user_data_dir; | 382 base::FilePath user_data_dir; |
387 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); | 383 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); |
388 ASSERT_TRUE(wallpaper_manager_test_utils::WriteJPEGFile( | 384 ASSERT_TRUE(wallpaper_manager_test_utils::WriteJPEGFile( |
389 user_data_dir.Append("123"), | 385 user_data_dir.Append("123"), |
390 wallpaper_manager_test_utils::kWallpaperSize, | 386 wallpaper_manager_test_utils::kWallpaperSize, |
391 wallpaper_manager_test_utils::kWallpaperSize, | 387 wallpaper_manager_test_utils::kWallpaperSize, |
392 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor)); | 388 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor)); |
393 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true); | 389 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true); |
394 } | 390 } |
395 | 391 |
396 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTestNoAnimation, | 392 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, |
397 UseMigratedWallpaperInfo) { | 393 UseMigratedWallpaperInfo) { |
398 LogIn(kTestUser1, kTestUser1Hash); | 394 LogIn(kTestUser1, kTestUser1Hash); |
399 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 395 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
400 // This test should finish normally. If timeout, it is probably because | 396 // This test should finish normally. If timeout, it is probably because |
401 // migrated wallpaper is somehow not loaded. Bad things can happen if | 397 // migrated wallpaper is somehow not loaded. Bad things can happen if |
402 // wallpaper is not loaded at login screen. One example is: crosbug.com/38429. | 398 // wallpaper is not loaded at login screen. One example is: crosbug.com/38429. |
403 } | 399 } |
404 | 400 |
405 // Same test as WallpaperManagerBrowserTest.UsePreMigrationWallpaperInfo. But | 401 // Same test as WallpaperManagerBrowserTest.UsePreMigrationWallpaperInfo. But |
406 // disabled boot and login animation. | 402 // disabled boot and login animation. |
407 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTestNoAnimation, | 403 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, |
408 PRE_UsePreMigrationWallpaperInfo) { | 404 PRE_UsePreMigrationWallpaperInfo) { |
409 // New user log in, a default wallpaper is loaded. | 405 // New user log in, a default wallpaper is loaded. |
410 LogIn(kTestUser1, kTestUser1Hash); | 406 LogIn(kTestUser1, kTestUser1Hash); |
411 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 407 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
412 // Old wallpaper migration code doesn't exist in codebase anymore. So if | 408 // Old wallpaper migration code doesn't exist in codebase anymore. So if |
413 // user's profile is not migrated, it is the same as no wallpaper info. To | 409 // user's profile is not migrated, it is the same as no wallpaper info. To |
414 // simulate this, we remove user's wallpaper info here. | 410 // simulate this, we remove user's wallpaper info here. |
415 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1); | 411 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1); |
416 } | 412 } |
417 | 413 |
418 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTestNoAnimation, | 414 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, |
419 UsePreMigrationWallpaperInfo) { | 415 UsePreMigrationWallpaperInfo) { |
420 LogIn(kTestUser1, kTestUser1Hash); | 416 LogIn(kTestUser1, kTestUser1Hash); |
421 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 417 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
422 // This test should finish normally. If timeout, it is probably because chrome | 418 // This test should finish normally. If timeout, it is probably because chrome |
423 // can not handle pre migrated user profile (M21 profile or older). | 419 // can not handle pre migrated user profile (M21 profile or older). |
424 } | 420 } |
425 | 421 |
426 class WallpaperManagerBrowserTestCrashRestore | 422 class WallpaperManagerBrowserTestCrashRestore |
427 : public WallpaperManagerBrowserTest { | 423 : public WallpaperManagerBrowserTest { |
428 public: | 424 public: |
429 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 425 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
430 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); | 426 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); |
431 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); | 427 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); |
432 command_line->AppendSwitch(::switches::kMultiProfiles); | |
433 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1); | 428 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1); |
434 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 429 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
435 } | 430 } |
436 }; | 431 }; |
437 | 432 |
438 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTestCrashRestore, | 433 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, |
439 PRE_RestoreWallpaper) { | 434 PRE_RestoreWallpaper) { |
440 LogIn(kTestUser1, kTestUser1Hash); | 435 LogIn(kTestUser1, kTestUser1Hash); |
441 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 436 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
442 } | 437 } |
443 | 438 |
444 // Test for crbug.com/270278. It simulates a browser crash and verifies if user | 439 // Test for crbug.com/270278. It simulates a browser crash and verifies if user |
445 // wallpaper is loaded. | 440 // wallpaper is loaded. |
446 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTestCrashRestore, | 441 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, |
447 RestoreWallpaper) { | 442 RestoreWallpaper) { |
448 EXPECT_EQ(1, LoadedWallpapers()); | 443 EXPECT_EQ(1, LoadedWallpapers()); |
449 } | 444 } |
450 | 445 |
451 class WallpaperManagerBrowserTestCacheUpdate | 446 class WallpaperManagerBrowserTestCacheUpdate |
452 : public WallpaperManagerBrowserTest { | 447 : public WallpaperManagerBrowserTest { |
453 public: | 448 public: |
454 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 449 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
455 command_line->AppendSwitch(::switches::kMultiProfiles); | |
456 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1); | 450 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1); |
457 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 451 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
458 } | 452 } |
459 protected: | 453 protected: |
460 // Creates a test image of size 1x1. | 454 // Creates a test image of size 1x1. |
461 gfx::ImageSkia CreateTestImage(SkColor color) { | 455 gfx::ImageSkia CreateTestImage(SkColor color) { |
462 return wallpaper_manager_test_utils::CreateTestImage(1, 1, color); | 456 return wallpaper_manager_test_utils::CreateTestImage(1, 1, color); |
463 } | 457 } |
464 }; | 458 }; |
465 | 459 |
466 // Sets kTestUser1's wallpaper to a custom wallpaper. | 460 // Sets kTestUser1's wallpaper to a custom wallpaper. |
467 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTestCacheUpdate, | 461 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCacheUpdate, |
468 PRE_VerifyWallpaperCache) { | 462 PRE_VerifyWallpaperCache) { |
469 // Add kTestUser1 to user list. kTestUser1 is the default login profile. | 463 // Add kTestUser1 to user list. kTestUser1 is the default login profile. |
470 LogIn(kTestUser1, kTestUser1Hash); | 464 LogIn(kTestUser1, kTestUser1Hash); |
471 | 465 |
472 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); | 466 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); |
473 WallpaperManager* wallpaper_manager = WallpaperManager::Get(); | 467 WallpaperManager* wallpaper_manager = WallpaperManager::Get(); |
474 base::FilePath small_wallpaper_path = GetCustomWallpaperPath( | 468 base::FilePath small_wallpaper_path = GetCustomWallpaperPath( |
475 kSmallWallpaperSubDir, | 469 kSmallWallpaperSubDir, |
476 kTestUser1Hash, | 470 kTestUser1Hash, |
477 id); | 471 id); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 507 |
514 // Tests for crbug.com/339576. Wallpaper cache should be updated in | 508 // Tests for crbug.com/339576. Wallpaper cache should be updated in |
515 // multi-profile mode when user: | 509 // multi-profile mode when user: |
516 // 1. chooses an online wallpaper from wallpaper | 510 // 1. chooses an online wallpaper from wallpaper |
517 // picker (calls SetWallpaperFromImageSkia); | 511 // picker (calls SetWallpaperFromImageSkia); |
518 // 2. chooses a custom wallpaper from wallpaper | 512 // 2. chooses a custom wallpaper from wallpaper |
519 // picker (calls SetCustomWallpaper); | 513 // picker (calls SetCustomWallpaper); |
520 // 3. reverts to a default wallpaper. | 514 // 3. reverts to a default wallpaper. |
521 // Also, when user login at multi-profile mode, previous logged in users' | 515 // Also, when user login at multi-profile mode, previous logged in users' |
522 // wallpaper cache should not be deleted. | 516 // wallpaper cache should not be deleted. |
523 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTestCacheUpdate, | 517 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCacheUpdate, |
524 VerifyWallpaperCache) { | 518 VerifyWallpaperCache) { |
525 WallpaperManager* wallpaper_manager = WallpaperManager::Get(); | 519 WallpaperManager* wallpaper_manager = WallpaperManager::Get(); |
526 | 520 |
527 // Force load initial wallpaper | 521 // Force load initial wallpaper |
528 // (simulate DesktopBackgroundController::UpdateDisplay()). | 522 // (simulate DesktopBackgroundController::UpdateDisplay()). |
529 wallpaper_manager->UpdateWallpaper(true); | 523 wallpaper_manager->UpdateWallpaper(true); |
530 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 524 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
531 scoped_ptr<WallpaperManager::TestApi> test_api; | 525 scoped_ptr<WallpaperManager::TestApi> test_api; |
532 test_api.reset(new WallpaperManager::TestApi(wallpaper_manager)); | 526 test_api.reset(new WallpaperManager::TestApi(wallpaper_manager)); |
533 gfx::ImageSkia cached_wallpaper; | 527 gfx::ImageSkia cached_wallpaper; |
(...skipping 30 matching lines...) Expand all Loading... |
564 // turned on. | 558 // turned on. |
565 EXPECT_TRUE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper)); | 559 EXPECT_TRUE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper)); |
566 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(green_wallpaper)); | 560 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(green_wallpaper)); |
567 | 561 |
568 wallpaper_manager->SetDefaultWallpaperNow(kTestUser1); | 562 wallpaper_manager->SetDefaultWallpaperNow(kTestUser1); |
569 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 563 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
570 // SetDefaultWallpaper should invalidate the user's wallpaper cache. | 564 // SetDefaultWallpaper should invalidate the user's wallpaper cache. |
571 EXPECT_FALSE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper)); | 565 EXPECT_FALSE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper)); |
572 } | 566 } |
573 | 567 |
574 INSTANTIATE_TEST_CASE_P(WallpaperManagerBrowserTestInstantiation, | |
575 WallpaperManagerBrowserTest, | |
576 testing::Bool()); | |
577 | |
578 INSTANTIATE_TEST_CASE_P(WallpaperManagerBrowserTestNoAnimationInstantiation, | |
579 WallpaperManagerBrowserTestNoAnimation, | |
580 testing::Bool()); | |
581 | |
582 INSTANTIATE_TEST_CASE_P(WallpaperManagerBrowserTestCrashRestoreInstantiation, | |
583 WallpaperManagerBrowserTestCrashRestore, | |
584 testing::Bool()); | |
585 | |
586 INSTANTIATE_TEST_CASE_P(WallpaperManagerBrowserTestCacheUpdateInstantiation, | |
587 WallpaperManagerBrowserTestCacheUpdate, | |
588 testing::Bool()); | |
589 | |
590 // ---------------------------------------------------------------------- | 568 // ---------------------------------------------------------------------- |
591 // Test default wallpapers. | 569 // Test default wallpapers. |
592 | 570 |
593 class TestObserver : public WallpaperManager::Observer { | 571 class TestObserver : public WallpaperManager::Observer { |
594 public: | 572 public: |
595 explicit TestObserver(WallpaperManager* wallpaper_manager) | 573 explicit TestObserver(WallpaperManager* wallpaper_manager) |
596 : update_wallpaper_count_(0), wallpaper_manager_(wallpaper_manager) { | 574 : update_wallpaper_count_(0), wallpaper_manager_(wallpaper_manager) { |
597 DCHECK(wallpaper_manager_); | 575 DCHECK(wallpaper_manager_); |
598 wallpaper_manager_->AddObserver(this); | 576 wallpaper_manager_->AddObserver(this); |
599 } | 577 } |
(...skipping 15 matching lines...) Expand all Loading... |
615 return old; | 593 return old; |
616 } | 594 } |
617 | 595 |
618 private: | 596 private: |
619 int update_wallpaper_count_; | 597 int update_wallpaper_count_; |
620 WallpaperManager* wallpaper_manager_; | 598 WallpaperManager* wallpaper_manager_; |
621 | 599 |
622 DISALLOW_COPY_AND_ASSIGN(TestObserver); | 600 DISALLOW_COPY_AND_ASSIGN(TestObserver); |
623 }; | 601 }; |
624 | 602 |
625 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, DisplayChange) { | 603 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, DisplayChange) { |
626 // TODO(derat|oshima|bshe): Host windows can't be resized on Win8. | 604 // TODO(derat|oshima|bshe): Host windows can't be resized on Win8. |
627 if (!ash::test::AshTestHelper::SupportsHostWindowResize()) | 605 if (!ash::test::AshTestHelper::SupportsHostWindowResize()) |
628 return; | 606 return; |
629 | 607 |
630 TestObserver observer(WallpaperManager::Get()); | 608 TestObserver observer(WallpaperManager::Get()); |
631 | 609 |
632 // Set the wallpaper to ensure that UpdateWallpaper() will be called when the | 610 // Set the wallpaper to ensure that UpdateWallpaper() will be called when the |
633 // display configuration changes. | 611 // display configuration changes. |
634 gfx::ImageSkia image = wallpaper_manager_test_utils::CreateTestImage( | 612 gfx::ImageSkia image = wallpaper_manager_test_utils::CreateTestImage( |
635 640, 480, wallpaper_manager_test_utils::kCustomWallpaperColor); | 613 640, 480, wallpaper_manager_test_utils::kCustomWallpaperColor); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 // Wait for asynchronous DisplayBackgroundController::UpdateDisplay() call. | 694 // Wait for asynchronous DisplayBackgroundController::UpdateDisplay() call. |
717 base::RunLoop().RunUntilIdle(); | 695 base::RunLoop().RunUntilIdle(); |
718 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 696 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
719 EXPECT_EQ(0, observer.GetUpdateWallpaperCountAndReset()); | 697 EXPECT_EQ(0, observer.GetUpdateWallpaperCountAndReset()); |
720 } | 698 } |
721 | 699 |
722 // Test that WallpaperManager loads the appropriate wallpaper | 700 // Test that WallpaperManager loads the appropriate wallpaper |
723 // images as specified via command-line flags in various situations. | 701 // images as specified via command-line flags in various situations. |
724 // Splitting these into separate tests avoids needing to run animations. | 702 // Splitting these into separate tests avoids needing to run animations. |
725 // TODO(derat): Combine these into a single test | 703 // TODO(derat): Combine these into a single test |
726 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, SmallDefaultWallpaper) { | 704 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, SmallDefaultWallpaper) { |
727 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) | 705 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) |
728 return; | 706 return; |
729 | 707 |
730 CreateCmdlineWallpapers(); | 708 CreateCmdlineWallpapers(); |
731 | 709 |
732 // At 800x600, the small wallpaper should be loaded. | 710 // At 800x600, the small wallpaper should be loaded. |
733 UpdateDisplay("800x600"); | 711 UpdateDisplay("800x600"); |
734 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); | 712 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); |
735 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 713 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
736 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( | 714 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( |
737 controller_->GetWallpaper(), | 715 controller_->GetWallpaper(), |
738 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); | 716 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); |
739 } | 717 } |
740 | 718 |
741 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, LargeDefaultWallpaper) { | 719 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, LargeDefaultWallpaper) { |
742 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) | 720 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) |
743 return; | 721 return; |
744 | 722 |
745 CreateCmdlineWallpapers(); | 723 CreateCmdlineWallpapers(); |
746 UpdateDisplay("1600x1200"); | 724 UpdateDisplay("1600x1200"); |
747 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); | 725 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); |
748 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 726 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
749 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( | 727 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( |
750 controller_->GetWallpaper(), | 728 controller_->GetWallpaper(), |
751 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor)); | 729 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor)); |
752 } | 730 } |
753 | 731 |
754 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, | 732 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, |
755 LargeDefaultWallpaperWhenRotated) { | 733 LargeDefaultWallpaperWhenRotated) { |
756 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) | 734 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) |
757 return; | 735 return; |
758 CreateCmdlineWallpapers(); | 736 CreateCmdlineWallpapers(); |
759 | 737 |
760 UpdateDisplay("1200x800/r"); | 738 UpdateDisplay("1200x800/r"); |
761 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); | 739 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); |
762 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 740 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
763 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( | 741 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( |
764 controller_->GetWallpaper(), | 742 controller_->GetWallpaper(), |
765 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor)); | 743 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor)); |
766 } | 744 } |
767 | 745 |
768 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, SmallGuestWallpaper) { | 746 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, SmallGuestWallpaper) { |
769 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) | 747 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) |
770 return; | 748 return; |
771 CreateCmdlineWallpapers(); | 749 CreateCmdlineWallpapers(); |
772 UserManager::Get()->UserLoggedIn( | 750 UserManager::Get()->UserLoggedIn( |
773 UserManager::kGuestUserName, UserManager::kGuestUserName, false); | 751 UserManager::kGuestUserName, UserManager::kGuestUserName, false); |
774 UpdateDisplay("800x600"); | 752 UpdateDisplay("800x600"); |
775 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); | 753 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); |
776 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 754 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
777 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( | 755 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( |
778 controller_->GetWallpaper(), | 756 controller_->GetWallpaper(), |
779 wallpaper_manager_test_utils::kSmallGuestWallpaperColor)); | 757 wallpaper_manager_test_utils::kSmallGuestWallpaperColor)); |
780 } | 758 } |
781 | 759 |
782 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, LargeGuestWallpaper) { | 760 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, LargeGuestWallpaper) { |
783 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) | 761 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) |
784 return; | 762 return; |
785 | 763 |
786 CreateCmdlineWallpapers(); | 764 CreateCmdlineWallpapers(); |
787 UserManager::Get()->UserLoggedIn( | 765 UserManager::Get()->UserLoggedIn( |
788 UserManager::kGuestUserName, UserManager::kGuestUserName, false); | 766 UserManager::kGuestUserName, UserManager::kGuestUserName, false); |
789 UpdateDisplay("1600x1200"); | 767 UpdateDisplay("1600x1200"); |
790 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); | 768 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); |
791 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 769 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
792 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( | 770 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( |
793 controller_->GetWallpaper(), | 771 controller_->GetWallpaper(), |
794 wallpaper_manager_test_utils::kLargeGuestWallpaperColor)); | 772 wallpaper_manager_test_utils::kLargeGuestWallpaperColor)); |
795 } | 773 } |
796 | 774 |
797 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, | 775 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, |
798 SwitchBetweenDefaultAndCustom) { | 776 SwitchBetweenDefaultAndCustom) { |
799 // Start loading the default wallpaper. | 777 // Start loading the default wallpaper. |
800 UpdateDisplay("640x480"); | 778 UpdateDisplay("640x480"); |
801 CreateCmdlineWallpapers(); | 779 CreateCmdlineWallpapers(); |
802 UserManager::Get()->UserLoggedIn(UserManager::kStubUser, "test_hash", false); | 780 UserManager::Get()->UserLoggedIn(UserManager::kStubUser, "test_hash", false); |
803 | 781 |
804 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); | 782 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); |
805 | 783 |
806 // Custom wallpaper should be applied immediately, canceling the default | 784 // Custom wallpaper should be applied immediately, canceling the default |
807 // wallpaper load task. | 785 // wallpaper load task. |
(...skipping 14 matching lines...) Expand all Loading... |
822 | 800 |
823 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); | 801 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); |
824 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 802 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
825 | 803 |
826 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( | 804 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( |
827 controller_->GetWallpaper(), | 805 controller_->GetWallpaper(), |
828 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); | 806 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); |
829 } | 807 } |
830 | 808 |
831 } // namespace chromeos | 809 } // namespace chromeos |
OLD | NEW |