| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wallpaper_manager.h" | 5 #include "chrome/browser/chromeos/login/wallpaper_manager.h" |
| 6 | 6 |
| 7 #include "ash/ash_resources/grit/ash_resources.h" | 7 #include "ash/ash_resources/grit/ash_resources.h" |
| 8 #include "ash/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "ash/desktop_background/desktop_background_controller_observer.h" | 9 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/test/display_manager_test_api.h" | 12 #include "ash/test/display_manager_test_api.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/prefs/scoped_user_pref_update.h" | 18 #include "base/prefs/scoped_user_pref_update.h" |
| 19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "chrome/browser/chromeos/login/user.h" | 22 #include "chrome/browser/chromeos/login/user.h" |
| 23 #include "chrome/browser/chromeos/login/user_manager.h" | 23 #include "chrome/browser/chromeos/login/user_manager.h" |
| 24 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/test/base/in_process_browser_test.h" | 26 #include "chrome/test/base/in_process_browser_test.h" |
| 27 #include "chrome/test/base/testing_browser_process.h" | 27 #include "chrome/test/base/testing_browser_process.h" |
| 28 #include "chromeos/chromeos_switches.h" | 28 #include "chromeos/chromeos_switches.h" |
| 29 #include "chromeos/dbus/cryptohome_client.h" | 29 #include "chromeos/dbus/cryptohome_client.h" |
| 30 #include "content/public/test/test_utils.h" |
| 30 #include "ui/aura/env.h" | 31 #include "ui/aura/env.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 32 | 33 |
| 33 using namespace ash; | 34 using namespace ash; |
| 34 | 35 |
| 35 namespace chromeos { | 36 namespace chromeos { |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 | 39 |
| 39 const int kLargeWallpaperResourceId = IDR_AURA_WALLPAPER_DEFAULT_LARGE; | 40 const int kLargeWallpaperResourceId = IDR_AURA_WALLPAPER_DEFAULT_LARGE; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // Set the wallpaper for |kTestUser1|. | 175 // Set the wallpaper for |kTestUser1|. |
| 175 wallpaper_manager->SetUserWallpaper(kTestUser1); | 176 wallpaper_manager->SetUserWallpaper(kTestUser1); |
| 176 WaitAsyncWallpaperLoad(); | 177 WaitAsyncWallpaperLoad(); |
| 177 gfx::ImageSkia wallpaper = controller_->GetWallpaper(); | 178 gfx::ImageSkia wallpaper = controller_->GetWallpaper(); |
| 178 | 179 |
| 179 // Display is initialized to 800x600. The small resolution custom wallpaper is | 180 // Display is initialized to 800x600. The small resolution custom wallpaper is |
| 180 // expected. | 181 // expected. |
| 181 EXPECT_EQ(kSmallWallpaperWidth, wallpaper.width()); | 182 EXPECT_EQ(kSmallWallpaperWidth, wallpaper.width()); |
| 182 EXPECT_EQ(kSmallWallpaperHeight, wallpaper.height()); | 183 EXPECT_EQ(kSmallWallpaperHeight, wallpaper.height()); |
| 183 | 184 |
| 184 // Hook up another 800x600 display. | 185 // Hook up another 800x600 display. This shouldn't trigger a reload. |
| 185 UpdateDisplay("800x600,800x600"); | 186 UpdateDisplay("800x600,800x600"); |
| 186 WaitAsyncWallpaperLoad(); | 187 content::RunAllPendingInMessageLoop(); |
| 187 // The small resolution custom wallpaper is expected. | 188 // The small resolution custom wallpaper is expected. |
| 188 EXPECT_EQ(kSmallWallpaperWidth, wallpaper.width()); | 189 EXPECT_EQ(kSmallWallpaperWidth, wallpaper.width()); |
| 189 EXPECT_EQ(kSmallWallpaperHeight, wallpaper.height()); | 190 EXPECT_EQ(kSmallWallpaperHeight, wallpaper.height()); |
| 190 | 191 |
| 191 // Detach the secondary display. | 192 // Detach the secondary display. |
| 192 UpdateDisplay("800x600"); | 193 UpdateDisplay("800x600"); |
| 193 // Hook up a 2000x2000 display. The large resolution custom wallpaper should | 194 // Hook up a 2000x2000 display. The large resolution custom wallpaper should |
| 194 // be loaded. | 195 // be loaded. |
| 195 UpdateDisplay("800x600,2000x2000"); | 196 UpdateDisplay("800x600,2000x2000"); |
| 196 WaitAsyncWallpaperLoad(); | 197 WaitAsyncWallpaperLoad(); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 } | 417 } |
| 417 | 418 |
| 418 // Test for crbug.com/270278. It simulates a browser crash and verifies if user | 419 // Test for crbug.com/270278. It simulates a browser crash and verifies if user |
| 419 // wallpaper is loaded. | 420 // wallpaper is loaded. |
| 420 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, | 421 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, |
| 421 RestoreWallpaper) { | 422 RestoreWallpaper) { |
| 422 EXPECT_EQ(1, LoadedWallpapers()); | 423 EXPECT_EQ(1, LoadedWallpapers()); |
| 423 } | 424 } |
| 424 | 425 |
| 425 } // namespace chromeos | 426 } // namespace chromeos |
| OLD | NEW |