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/desktop_background/desktop_background_resources.h" | 7 #include "ash/desktop_background/desktop_background_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/multi_display_manager.h" | 10 #include "ash/display/display_manager.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/test/multi_display_manager_test_api.h" | 12 #include "ash/test/display_manager_test_api.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 18 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
19 #include "chrome/browser/chromeos/login/user.h" | 19 #include "chrome/browser/chromeos/login/user.h" |
20 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 20 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
21 #include "chrome/test/base/testing_browser_process.h" | 21 #include "chrome/test/base/testing_browser_process.h" |
22 #include "ui/aura/env.h" | 22 #include "ui/aura/env.h" |
23 #include "ui/aura/display_manager.h" | |
24 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
25 | 24 |
26 using namespace ash; | 25 using namespace ash; |
27 | 26 |
28 namespace chromeos { | 27 namespace chromeos { |
29 | 28 |
30 namespace { | 29 namespace { |
31 | 30 |
32 const char kTestUser1[] = "test-user@example.com"; | 31 const char kTestUser1[] = "test-user@example.com"; |
33 | 32 |
(...skipping 29 matching lines...) Expand all Loading... |
63 local_state_ = g_browser_process->local_state(); | 62 local_state_ = g_browser_process->local_state(); |
64 UpdateDisplay("800x600"); | 63 UpdateDisplay("800x600"); |
65 } | 64 } |
66 | 65 |
67 virtual void CleanUpOnMainThread() OVERRIDE { | 66 virtual void CleanUpOnMainThread() OVERRIDE { |
68 controller_->RemoveObserver(this); | 67 controller_->RemoveObserver(this); |
69 controller_ = NULL; | 68 controller_ = NULL; |
70 } | 69 } |
71 | 70 |
72 // Update the display configuration as given in |display_specs|. | 71 // Update the display configuration as given in |display_specs|. |
73 // See ash::test::MultiDisplayManagerTestApi::UpdateDisplay for more | 72 // See ash::test::DisplayManagerTestApi::UpdateDisplay for more |
74 // details. | 73 // details. |
75 void UpdateDisplay(const std::string& display_specs) { | 74 void UpdateDisplay(const std::string& display_specs) { |
76 internal::MultiDisplayManager* multi_display_manager = | 75 ash::test::DisplayManagerTestApi display_manager_test_api( |
77 static_cast<internal::MultiDisplayManager*>( | 76 ash::Shell::GetInstance()->display_manager()); |
78 aura::Env::GetInstance()->display_manager()); | 77 display_manager_test_api.UpdateDisplay(display_specs); |
79 ash::test::MultiDisplayManagerTestApi multi_display_manager_test_api( | |
80 multi_display_manager); | |
81 multi_display_manager_test_api.UpdateDisplay(display_specs); | |
82 } | 78 } |
83 | 79 |
84 void WaitAsyncWallpaperLoad() { | 80 void WaitAsyncWallpaperLoad() { |
85 MessageLoop::current()->Run(); | 81 MessageLoop::current()->Run(); |
86 } | 82 } |
87 | 83 |
88 virtual void OnWallpaperDataChanged() OVERRIDE { | 84 virtual void OnWallpaperDataChanged() OVERRIDE { |
89 MessageLoop::current()->Quit(); | 85 MessageLoop::current()->Quit(); |
90 } | 86 } |
91 | 87 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 UpdateDisplay("800x600,2000x2000"); | 210 UpdateDisplay("800x600,2000x2000"); |
215 WaitAsyncWallpaperLoad(); | 211 WaitAsyncWallpaperLoad(); |
216 wallpaper = controller_->GetWallpaper(); | 212 wallpaper = controller_->GetWallpaper(); |
217 | 213 |
218 // The large resolution custom wallpaper is expected. | 214 // The large resolution custom wallpaper is expected. |
219 EXPECT_EQ(kExpectedLargeWallpaperWidth, wallpaper.width()); | 215 EXPECT_EQ(kExpectedLargeWallpaperWidth, wallpaper.width()); |
220 EXPECT_EQ(kExpectedLargeWallpaperHeight, wallpaper.height()); | 216 EXPECT_EQ(kExpectedLargeWallpaperHeight, wallpaper.height()); |
221 } | 217 } |
222 | 218 |
223 } // namepace chromeos | 219 } // namepace chromeos |
OLD | NEW |