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 "ash/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 base::TimeTicks step_time = controller.animator()->last_step_time(); | 93 base::TimeTicks step_time = controller.animator()->last_step_time(); |
94 element->Step(step_time + base::TimeDelta::FromMilliseconds(1000)); | 94 element->Step(step_time + base::TimeDelta::FromMilliseconds(1000)); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 } // namespace | 98 } // namespace |
99 | 99 |
100 class DesktopBackgroundControllerTest : public test::AshTestBase { | 100 class DesktopBackgroundControllerTest : public test::AshTestBase { |
101 public: | 101 public: |
102 DesktopBackgroundControllerTest() | 102 DesktopBackgroundControllerTest() |
103 : ui_thread_(content::BrowserThread::UI, base::MessageLoop::current()), | 103 : command_line_(CommandLine::NO_PROGRAM), |
104 command_line_(CommandLine::NO_PROGRAM), | |
105 controller_(NULL) { | 104 controller_(NULL) { |
106 } | 105 } |
107 virtual ~DesktopBackgroundControllerTest() {} | 106 virtual ~DesktopBackgroundControllerTest() {} |
108 | 107 |
109 virtual void SetUp() OVERRIDE { | 108 virtual void SetUp() OVERRIDE { |
110 test::AshTestBase::SetUp(); | 109 test::AshTestBase::SetUp(); |
111 // Ash shell initialization creates wallpaper. Reset it so we can manually | 110 // Ash shell initialization creates wallpaper. Reset it so we can manually |
112 // control wallpaper creation and animation in our tests. | 111 // control wallpaper creation and animation in our tests. |
113 RootWindowController* root_window_controller = | 112 RootWindowController* root_window_controller = |
114 Shell::GetPrimaryRootWindowController(); | 113 Shell::GetPrimaryRootWindowController(); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 const base::FilePath kSmallGuestPath = | 239 const base::FilePath kSmallGuestPath = |
241 wallpaper_dir_->path().Append(FILE_PATH_LITERAL("guest_small.jpg")); | 240 wallpaper_dir_->path().Append(FILE_PATH_LITERAL("guest_small.jpg")); |
242 ASSERT_TRUE(WriteJPEGFile(kSmallGuestPath, kWallpaperSize, kWallpaperSize, | 241 ASSERT_TRUE(WriteJPEGFile(kSmallGuestPath, kWallpaperSize, kWallpaperSize, |
243 kSmallGuestWallpaperColor)); | 242 kSmallGuestWallpaperColor)); |
244 command_line_.AppendSwitchPath( | 243 command_line_.AppendSwitchPath( |
245 switches::kAshDefaultGuestWallpaperSmall, kSmallGuestPath); | 244 switches::kAshDefaultGuestWallpaperSmall, kSmallGuestPath); |
246 | 245 |
247 controller_->set_command_line_for_testing(&command_line_); | 246 controller_->set_command_line_for_testing(&command_line_); |
248 } | 247 } |
249 | 248 |
250 content::TestBrowserThread ui_thread_; | |
251 | |
252 // Custom command line passed to DesktopBackgroundController by | 249 // Custom command line passed to DesktopBackgroundController by |
253 // WriteWallpapersAndSetFlags(). | 250 // WriteWallpapersAndSetFlags(). |
254 CommandLine command_line_; | 251 CommandLine command_line_; |
255 | 252 |
256 // Directory created by WriteWallpapersAndSetFlags() to store default | 253 // Directory created by WriteWallpapersAndSetFlags() to store default |
257 // wallpaper images. | 254 // wallpaper images. |
258 scoped_ptr<base::ScopedTempDir> wallpaper_dir_; | 255 scoped_ptr<base::ScopedTempDir> wallpaper_dir_; |
259 | 256 |
260 DesktopBackgroundController* controller_; // Not owned. | 257 DesktopBackgroundController* controller_; // Not owned. |
261 | 258 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 Shell::GetInstance()->display_manager()); | 519 Shell::GetInstance()->display_manager()); |
523 display_manager_test_api.UpdateDisplay("1600x1200"); | 520 display_manager_test_api.UpdateDisplay("1600x1200"); |
524 ASSERT_TRUE(controller_->SetDefaultWallpaper(true)); | 521 ASSERT_TRUE(controller_->SetDefaultWallpaper(true)); |
525 observer.WaitForWallpaperDataChanged(); | 522 observer.WaitForWallpaperDataChanged(); |
526 EXPECT_TRUE(ImageIsNearColor(controller_->GetWallpaper(), | 523 EXPECT_TRUE(ImageIsNearColor(controller_->GetWallpaper(), |
527 kLargeGuestWallpaperColor)); | 524 kLargeGuestWallpaperColor)); |
528 } | 525 } |
529 | 526 |
530 } // namespace internal | 527 } // namespace internal |
531 } // namespace ash | 528 } // namespace ash |
OLD | NEW |