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