| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/common/wallpaper/wallpaper_controller.h" | 9 #include "ash/common/wallpaper/wallpaper_controller.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/display/display_manager.h" | |
| 12 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 13 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 14 #include "ash/test/ash_test_helper.h" | 13 #include "ash/test/ash_test_helper.h" |
| 15 #include "ash/test/display_manager_test_api.h" | |
| 16 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 17 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 18 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 19 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
| 20 #include "base/macros.h" | 18 #include "base/macros.h" |
| 21 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
| 22 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 23 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 25 #include "base/values.h" | 23 #include "base/values.h" |
| 26 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_u
tils.h" | 24 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_u
tils.h" |
| 27 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 28 #include "chrome/test/base/in_process_browser_test.h" | 26 #include "chrome/test/base/in_process_browser_test.h" |
| 29 #include "chrome/test/base/testing_browser_process.h" | 27 #include "chrome/test/base/testing_browser_process.h" |
| 30 #include "chromeos/chromeos_switches.h" | 28 #include "chromeos/chromeos_switches.h" |
| 31 #include "chromeos/login/user_names.h" | 29 #include "chromeos/login/user_names.h" |
| 32 #include "components/prefs/scoped_user_pref_update.h" | 30 #include "components/prefs/scoped_user_pref_update.h" |
| 33 #include "components/signin/core/account_id/account_id.h" | 31 #include "components/signin/core/account_id/account_id.h" |
| 34 #include "components/user_manager/user.h" | 32 #include "components/user_manager/user.h" |
| 35 #include "components/user_manager/user_manager.h" | 33 #include "components/user_manager/user_manager.h" |
| 36 #include "components/wallpaper/wallpaper_files_id.h" | 34 #include "components/wallpaper/wallpaper_files_id.h" |
| 37 #include "content/public/test/test_utils.h" | 35 #include "content/public/test/test_utils.h" |
| 38 #include "ui/aura/env.h" | 36 #include "ui/aura/env.h" |
| 37 #include "ui/display/manager/display_manager.h" |
| 38 #include "ui/display/test/display_manager_test_api.h" |
| 39 #include "ui/gfx/geometry/point.h" | 39 #include "ui/gfx/geometry/point.h" |
| 40 #include "ui/gfx/geometry/rect.h" | 40 #include "ui/gfx/geometry/rect.h" |
| 41 #include "ui/gfx/image/image_skia.h" | 41 #include "ui/gfx/image/image_skia.h" |
| 42 | 42 |
| 43 using wallpaper::WallpaperInfo; | 43 using wallpaper::WallpaperInfo; |
| 44 using wallpaper::WALLPAPER_LAYOUT_CENTER; | 44 using wallpaper::WALLPAPER_LAYOUT_CENTER; |
| 45 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; | 45 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; |
| 46 using wallpaper::WALLPAPER_LAYOUT_STRETCH; | 46 using wallpaper::WALLPAPER_LAYOUT_STRETCH; |
| 47 using wallpaper::WALLPAPER_LAYOUT_TILE; | 47 using wallpaper::WALLPAPER_LAYOUT_TILE; |
| 48 | 48 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 void SetUpCommandLine(base::CommandLine* command_line) override { | 80 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 void TearDownOnMainThread() override { controller_ = NULL; } | 85 void TearDownOnMainThread() override { controller_ = NULL; } |
| 86 | 86 |
| 87 // Update the display configuration as given in |display_specs|. See | 87 // Update the display configuration as given in |display_specs|. See |
| 88 // ash::test::DisplayManagerTestApi::UpdateDisplay for more details. | 88 // display::test::DisplayManagerTestApi::UpdateDisplay for more details. |
| 89 void UpdateDisplay(const std::string& display_specs) { | 89 void UpdateDisplay(const std::string& display_specs) { |
| 90 ash::test::DisplayManagerTestApi( | 90 display::test::DisplayManagerTestApi( |
| 91 ash::Shell::GetInstance()->display_manager()) | 91 ash::Shell::GetInstance()->display_manager()) |
| 92 .UpdateDisplay(display_specs); | 92 .UpdateDisplay(display_specs); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void WaitAsyncWallpaperLoadStarted() { | 95 void WaitAsyncWallpaperLoadStarted() { |
| 96 base::RunLoop().RunUntilIdle(); | 96 base::RunLoop().RunUntilIdle(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 protected: | 99 protected: |
| 100 | 100 |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 | 845 |
| 846 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); | 846 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); |
| 847 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); | 847 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); |
| 848 | 848 |
| 849 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( | 849 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( |
| 850 controller_->GetWallpaper(), | 850 controller_->GetWallpaper(), |
| 851 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); | 851 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); |
| 852 } | 852 } |
| 853 | 853 |
| 854 } // namespace chromeos | 854 } // namespace chromeos |
| OLD | NEW |