| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 virtual ~WallpaperManagerBrowserTest () {} | 70 virtual ~WallpaperManagerBrowserTest () {} |
| 71 | 71 |
| 72 virtual void SetUpOnMainThread() override { | 72 virtual void SetUpOnMainThread() override { |
| 73 controller_ = ash::Shell::GetInstance()->desktop_background_controller(); | 73 controller_ = ash::Shell::GetInstance()->desktop_background_controller(); |
| 74 local_state_ = g_browser_process->local_state(); | 74 local_state_ = g_browser_process->local_state(); |
| 75 ash::DesktopBackgroundController::TestAPI(controller_) | 75 ash::DesktopBackgroundController::TestAPI(controller_) |
| 76 .set_wallpaper_reload_delay_for_test(0); | 76 .set_wallpaper_reload_delay_for_test(0); |
| 77 UpdateDisplay("800x600"); | 77 UpdateDisplay("800x600"); |
| 78 } | 78 } |
| 79 | 79 |
| 80 virtual void SetUpCommandLine(CommandLine* command_line) override { | 80 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
| 81 command_line->AppendSwitch(switches::kLoginManager); | 81 command_line->AppendSwitch(switches::kLoginManager); |
| 82 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 82 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
| 83 } | 83 } |
| 84 | 84 |
| 85 virtual void TearDownOnMainThread() override { | 85 virtual void TearDownOnMainThread() override { |
| 86 controller_ = NULL; | 86 controller_ = NULL; |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Update the display configuration as given in |display_specs|. See | 89 // Update the display configuration as given in |display_specs|. See |
| 90 // ash::test::DisplayManagerTestApi::UpdateDisplay for more details. | 90 // ash::test::DisplayManagerTestApi::UpdateDisplay for more details. |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 341 |
| 342 // Hook up a 2000x2000 display. The large resolution custom wallpaper should | 342 // Hook up a 2000x2000 display. The large resolution custom wallpaper should |
| 343 // be loaded. | 343 // be loaded. |
| 344 UpdateDisplay("800x600,2000x2000"); | 344 UpdateDisplay("800x600,2000x2000"); |
| 345 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 345 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 class WallpaperManagerBrowserTestNoAnimation | 348 class WallpaperManagerBrowserTestNoAnimation |
| 349 : public WallpaperManagerBrowserTest { | 349 : public WallpaperManagerBrowserTest { |
| 350 public: | 350 public: |
| 351 virtual void SetUpCommandLine(CommandLine* command_line) override { | 351 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
| 352 command_line->AppendSwitch(switches::kLoginManager); | 352 command_line->AppendSwitch(switches::kLoginManager); |
| 353 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 353 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
| 354 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); | 354 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); |
| 355 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); | 355 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); |
| 356 } | 356 } |
| 357 }; | 357 }; |
| 358 | 358 |
| 359 // Same test as WallpaperManagerBrowserTest.UseMigratedWallpaperInfo. But | 359 // Same test as WallpaperManagerBrowserTest.UseMigratedWallpaperInfo. But |
| 360 // disabled boot and login animation. | 360 // disabled boot and login animation. |
| 361 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, | 361 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 UsePreMigrationWallpaperInfo) { | 404 UsePreMigrationWallpaperInfo) { |
| 405 LogIn(kTestUser1, kTestUser1Hash); | 405 LogIn(kTestUser1, kTestUser1Hash); |
| 406 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 406 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
| 407 // This test should finish normally. If timeout, it is probably because chrome | 407 // This test should finish normally. If timeout, it is probably because chrome |
| 408 // can not handle pre migrated user profile (M21 profile or older). | 408 // can not handle pre migrated user profile (M21 profile or older). |
| 409 } | 409 } |
| 410 | 410 |
| 411 class WallpaperManagerBrowserTestCrashRestore | 411 class WallpaperManagerBrowserTestCrashRestore |
| 412 : public WallpaperManagerBrowserTest { | 412 : public WallpaperManagerBrowserTest { |
| 413 public: | 413 public: |
| 414 virtual void SetUpCommandLine(CommandLine* command_line) override { | 414 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
| 415 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); | 415 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); |
| 416 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); | 416 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); |
| 417 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1); | 417 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1); |
| 418 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 418 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
| 419 } | 419 } |
| 420 }; | 420 }; |
| 421 | 421 |
| 422 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, | 422 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, |
| 423 PRE_RestoreWallpaper) { | 423 PRE_RestoreWallpaper) { |
| 424 LogIn(kTestUser1, kTestUser1Hash); | 424 LogIn(kTestUser1, kTestUser1Hash); |
| 425 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 425 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
| 426 } | 426 } |
| 427 | 427 |
| 428 // Test for crbug.com/270278. It simulates a browser crash and verifies if user | 428 // Test for crbug.com/270278. It simulates a browser crash and verifies if user |
| 429 // wallpaper is loaded. | 429 // wallpaper is loaded. |
| 430 // Fails on the MSAN bots. See http://crbug.com/444477 | 430 // Fails on the MSAN bots. See http://crbug.com/444477 |
| 431 #if defined(MEMORY_SANITIZER) | 431 #if defined(MEMORY_SANITIZER) |
| 432 #define MAYBE_RestoreWallpaper DISABLED_RestoreWallpaper | 432 #define MAYBE_RestoreWallpaper DISABLED_RestoreWallpaper |
| 433 #else | 433 #else |
| 434 #define MAYBE_RestoreWallpaper RestoreWallpaper | 434 #define MAYBE_RestoreWallpaper RestoreWallpaper |
| 435 #endif | 435 #endif |
| 436 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, | 436 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, |
| 437 MAYBE_RestoreWallpaper) { | 437 MAYBE_RestoreWallpaper) { |
| 438 EXPECT_EQ(1, LoadedWallpapers()); | 438 EXPECT_EQ(1, LoadedWallpapers()); |
| 439 } | 439 } |
| 440 | 440 |
| 441 class WallpaperManagerBrowserTestCacheUpdate | 441 class WallpaperManagerBrowserTestCacheUpdate |
| 442 : public WallpaperManagerBrowserTest { | 442 : public WallpaperManagerBrowserTest { |
| 443 public: | 443 public: |
| 444 virtual void SetUpCommandLine(CommandLine* command_line) override { | 444 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
| 445 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1); | 445 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1); |
| 446 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 446 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
| 447 } | 447 } |
| 448 protected: | 448 protected: |
| 449 // Creates a test image of size 1x1. | 449 // Creates a test image of size 1x1. |
| 450 gfx::ImageSkia CreateTestImage(SkColor color) { | 450 gfx::ImageSkia CreateTestImage(SkColor color) { |
| 451 return wallpaper_manager_test_utils::CreateTestImage(1, 1, color); | 451 return wallpaper_manager_test_utils::CreateTestImage(1, 1, color); |
| 452 } | 452 } |
| 453 }; | 453 }; |
| 454 | 454 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 | 789 |
| 790 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); | 790 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); |
| 791 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 791 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
| 792 | 792 |
| 793 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( | 793 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( |
| 794 controller_->GetWallpaper(), | 794 controller_->GetWallpaper(), |
| 795 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); | 795 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); |
| 796 } | 796 } |
| 797 | 797 |
| 798 } // namespace chromeos | 798 } // namespace chromeos |
| OLD | NEW |