| Index: ash/desktop_background/desktop_background_controller_unittest.cc
|
| diff --git a/ash/desktop_background/desktop_background_controller_unittest.cc b/ash/desktop_background/desktop_background_controller_unittest.cc
|
| index 1c4810598756e008649fb3165bedc6eac567b903..b759234fe09e8003529de2655d9abdee7ef7bcc7 100644
|
| --- a/ash/desktop_background/desktop_background_controller_unittest.cc
|
| +++ b/ash/desktop_background/desktop_background_controller_unittest.cc
|
| @@ -16,7 +16,6 @@
|
| #include "ash/test/ash_test_base.h"
|
| #include "ash/test/display_manager_test_api.h"
|
| #include "ash/test/test_user_wallpaper_delegate.h"
|
| -#include "base/command_line.h"
|
| #include "base/file_util.h"
|
| #include "base/files/file_path.h"
|
| #include "base/files/scoped_temp_dir.h"
|
| @@ -102,8 +101,7 @@ void RunAnimationForWidget(views::Widget* widget) {
|
| class DesktopBackgroundControllerTest : public test::AshTestBase {
|
| public:
|
| DesktopBackgroundControllerTest()
|
| - : command_line_(CommandLine::NO_PROGRAM),
|
| - controller_(NULL) {
|
| + : controller_(NULL) {
|
| }
|
| virtual ~DesktopBackgroundControllerTest() {}
|
|
|
| @@ -234,41 +232,32 @@ class DesktopBackgroundControllerTest : public test::AshTestBase {
|
| wallpaper_dir_.reset(new base::ScopedTempDir);
|
| ASSERT_TRUE(wallpaper_dir_->CreateUniqueTempDir());
|
|
|
| - const base::FilePath kLargePath =
|
| + default_large_file_ =
|
| wallpaper_dir_->path().Append(FILE_PATH_LITERAL("large.jpg"));
|
| - ASSERT_TRUE(WriteJPEGFile(kLargePath, kWallpaperSize, kWallpaperSize,
|
| + ASSERT_TRUE(WriteJPEGFile(default_large_file_,
|
| + kWallpaperSize,
|
| + kWallpaperSize,
|
| kLargeWallpaperColor));
|
| - command_line_.AppendSwitchPath(
|
| - switches::kAshDefaultWallpaperLarge, kLargePath);
|
| -
|
| - const base::FilePath kSmallPath =
|
| + default_small_file_ =
|
| wallpaper_dir_->path().Append(FILE_PATH_LITERAL("small.jpg"));
|
| - ASSERT_TRUE(WriteJPEGFile(kSmallPath, kWallpaperSize, kWallpaperSize,
|
| + ASSERT_TRUE(WriteJPEGFile(default_small_file_,
|
| + kWallpaperSize,
|
| + kWallpaperSize,
|
| kSmallWallpaperColor));
|
| - command_line_.AppendSwitchPath(
|
| - switches::kAshDefaultWallpaperSmall, kSmallPath);
|
| -
|
| - const base::FilePath kLargeGuestPath =
|
| + guest_default_large_file_ =
|
| wallpaper_dir_->path().Append(FILE_PATH_LITERAL("guest_large.jpg"));
|
| - ASSERT_TRUE(WriteJPEGFile(kLargeGuestPath, kWallpaperSize, kWallpaperSize,
|
| + ASSERT_TRUE(WriteJPEGFile(guest_default_large_file_,
|
| + kWallpaperSize,
|
| + kWallpaperSize,
|
| kLargeGuestWallpaperColor));
|
| - command_line_.AppendSwitchPath(
|
| - switches::kAshGuestWallpaperLarge, kLargeGuestPath);
|
| -
|
| - const base::FilePath kSmallGuestPath =
|
| + guest_default_small_file_ =
|
| wallpaper_dir_->path().Append(FILE_PATH_LITERAL("guest_small.jpg"));
|
| - ASSERT_TRUE(WriteJPEGFile(kSmallGuestPath, kWallpaperSize, kWallpaperSize,
|
| + ASSERT_TRUE(WriteJPEGFile(guest_default_small_file_,
|
| + kWallpaperSize,
|
| + kWallpaperSize,
|
| kSmallGuestWallpaperColor));
|
| - command_line_.AppendSwitchPath(
|
| - switches::kAshGuestWallpaperSmall, kSmallGuestPath);
|
| -
|
| - controller_->set_command_line_for_testing(&command_line_);
|
| }
|
|
|
| - // Custom command line passed to DesktopBackgroundController by
|
| - // WriteWallpapersAndSetFlags().
|
| - CommandLine command_line_;
|
| -
|
| // Directory created by WriteWallpapersAndSetFlags() to store default
|
| // wallpaper images.
|
| scoped_ptr<base::ScopedTempDir> wallpaper_dir_;
|
| @@ -277,6 +266,12 @@ class DesktopBackgroundControllerTest : public test::AshTestBase {
|
|
|
| test::TestUserWallpaperDelegate* wallpaper_delegate_;
|
|
|
| + base::FilePath default_small_file_;
|
| + base::FilePath default_large_file_;
|
| +
|
| + base::FilePath guest_default_small_file_;
|
| + base::FilePath guest_default_large_file_;
|
| +
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundControllerTest);
|
| };
|
| @@ -531,13 +526,15 @@ TEST_F(DesktopBackgroundControllerTest, SmallDefaultWallpaper) {
|
| test::DisplayManagerTestApi display_manager_test_api(
|
| Shell::GetInstance()->display_manager());
|
| display_manager_test_api.UpdateDisplay("800x600");
|
| - ASSERT_TRUE(controller_->SetDefaultWallpaper(false));
|
| + ASSERT_TRUE(controller_->SetDefaultWallpaper(default_small_file_,
|
| + default_large_file_));
|
| observer.WaitForWallpaperDataChanged();
|
| EXPECT_TRUE(ImageIsNearColor(controller_->GetWallpaper(),
|
| kSmallWallpaperColor));
|
|
|
| // Requesting the same wallpaper again should be a no-op.
|
| - ASSERT_FALSE(controller_->SetDefaultWallpaper(false));
|
| + ASSERT_FALSE(controller_->SetDefaultWallpaper(default_small_file_,
|
| + default_large_file_));
|
| }
|
|
|
| TEST_F(DesktopBackgroundControllerTest, LargeDefaultWallpaper) {
|
| @@ -549,7 +546,8 @@ TEST_F(DesktopBackgroundControllerTest, LargeDefaultWallpaper) {
|
| test::DisplayManagerTestApi display_manager_test_api(
|
| Shell::GetInstance()->display_manager());
|
| display_manager_test_api.UpdateDisplay("1600x1200");
|
| - ASSERT_TRUE(controller_->SetDefaultWallpaper(false));
|
| + ASSERT_TRUE(controller_->SetDefaultWallpaper(default_small_file_,
|
| + default_large_file_));
|
| observer.WaitForWallpaperDataChanged();
|
| EXPECT_TRUE(ImageIsNearColor(controller_->GetWallpaper(),
|
| kLargeWallpaperColor));
|
| @@ -564,7 +562,8 @@ TEST_F(DesktopBackgroundControllerTest, LargeDefaultWallpaperWhenRotated) {
|
| Shell::GetInstance()->display_manager());
|
|
|
| display_manager_test_api.UpdateDisplay("1200x800/r");
|
| - ASSERT_TRUE(controller_->SetDefaultWallpaper(false));
|
| + ASSERT_TRUE(controller_->SetDefaultWallpaper(default_small_file_,
|
| + default_large_file_));
|
| observer.WaitForWallpaperDataChanged();
|
| EXPECT_TRUE(ImageIsNearColor(controller_->GetWallpaper(),
|
| kLargeWallpaperColor));
|
| @@ -579,7 +578,8 @@ TEST_F(DesktopBackgroundControllerTest, SmallGuestWallpaper) {
|
| test::DisplayManagerTestApi display_manager_test_api(
|
| Shell::GetInstance()->display_manager());
|
| display_manager_test_api.UpdateDisplay("800x600");
|
| - ASSERT_TRUE(controller_->SetDefaultWallpaper(true));
|
| + ASSERT_TRUE(controller_->SetDefaultWallpaper(guest_default_small_file_,
|
| + guest_default_large_file_));
|
| observer.WaitForWallpaperDataChanged();
|
| EXPECT_TRUE(ImageIsNearColor(controller_->GetWallpaper(),
|
| kSmallGuestWallpaperColor));
|
| @@ -594,7 +594,8 @@ TEST_F(DesktopBackgroundControllerTest, LargeGuestWallpaper) {
|
| test::DisplayManagerTestApi display_manager_test_api(
|
| Shell::GetInstance()->display_manager());
|
| display_manager_test_api.UpdateDisplay("1600x1200");
|
| - ASSERT_TRUE(controller_->SetDefaultWallpaper(true));
|
| + ASSERT_TRUE(controller_->SetDefaultWallpaper(guest_default_small_file_,
|
| + guest_default_large_file_));
|
| observer.WaitForWallpaperDataChanged();
|
| EXPECT_TRUE(ImageIsNearColor(controller_->GetWallpaper(),
|
| kLargeGuestWallpaperColor));
|
| @@ -674,7 +675,8 @@ TEST_F(DesktopBackgroundControllerTest, SwitchBetweenDefaultAndCustom) {
|
| // Start loading the default wallpaper.
|
| UpdateDisplay("640x480");
|
| WriteWallpapersAndSetFlags();
|
| - ASSERT_TRUE(controller_->SetDefaultWallpaper(false));
|
| + ASSERT_TRUE(controller_->SetDefaultWallpaper(default_small_file_,
|
| + default_large_file_));
|
|
|
| // Custom wallpaper should be applied immediately, canceling the default
|
| // wallpaper load task.
|
| @@ -687,7 +689,8 @@ TEST_F(DesktopBackgroundControllerTest, SwitchBetweenDefaultAndCustom) {
|
| // new load task was started (since the previous one was interrupted by
|
| // SetCustomWallpaper()). See http://crbug.com/327443.
|
| TestObserver observer(controller_);
|
| - ASSERT_TRUE(controller_->SetDefaultWallpaper(false));
|
| + ASSERT_TRUE(controller_->SetDefaultWallpaper(default_small_file_,
|
| + default_large_file_));
|
| observer.WaitForWallpaperDataChanged();
|
| EXPECT_TRUE(ImageIsNearColor(controller_->GetWallpaper(),
|
| kSmallWallpaperColor));
|
|
|