Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: ash/desktop_background/desktop_background_controller_unittest.cc

Issue 2271373002: mash: Port mojo:ash_sysui's ContextMenuMus to mojo:ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/shell_window_ids.h" 10 #include "ash/common/shell_window_ids.h"
11 #include "ash/common/wm_shell.h"
11 #include "ash/desktop_background/desktop_background_view.h" 12 #include "ash/desktop_background/desktop_background_view.h"
12 #include "ash/desktop_background/desktop_background_widget_controller.h" 13 #include "ash/desktop_background/desktop_background_widget_controller.h"
13 #include "ash/root_window_controller.h" 14 #include "ash/root_window_controller.h"
14 #include "ash/shell.h" 15 #include "ash/shell.h"
15 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
16 #include "ash/test/test_user_wallpaper_delegate.h" 17 #include "ash/test/test_wallpaper_delegate.h"
17 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
18 #include "base/run_loop.h" 19 #include "base/run_loop.h"
19 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
20 #include "base/threading/sequenced_worker_pool.h" 21 #include "base/threading/sequenced_worker_pool.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 22 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "third_party/skia/include/core/SkColor.h" 23 #include "third_party/skia/include/core/SkColor.h"
23 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 24 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
24 #include "ui/compositor/test/layer_animator_test_controller.h" 25 #include "ui/compositor/test/layer_animator_test_controller.h"
25 #include "ui/gfx/canvas.h" 26 #include "ui/gfx/canvas.h"
26 #include "ui/views/widget/widget.h" 27 #include "ui/views/widget/widget.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 109
109 void SetUp() override { 110 void SetUp() override {
110 test::AshTestBase::SetUp(); 111 test::AshTestBase::SetUp();
111 // Ash shell initialization creates wallpaper. Reset it so we can manually 112 // Ash shell initialization creates wallpaper. Reset it so we can manually
112 // control wallpaper creation and animation in our tests. 113 // control wallpaper creation and animation in our tests.
113 RootWindowController* root_window_controller = 114 RootWindowController* root_window_controller =
114 Shell::GetPrimaryRootWindowController(); 115 Shell::GetPrimaryRootWindowController();
115 root_window_controller->SetWallpaperController(NULL); 116 root_window_controller->SetWallpaperController(NULL);
116 root_window_controller->SetAnimatingWallpaperController(NULL); 117 root_window_controller->SetAnimatingWallpaperController(NULL);
117 controller_ = Shell::GetInstance()->desktop_background_controller(); 118 controller_ = Shell::GetInstance()->desktop_background_controller();
118 wallpaper_delegate_ = static_cast<test::TestUserWallpaperDelegate*>( 119 wallpaper_delegate_ = static_cast<test::TestWallpaperDelegate*>(
119 Shell::GetInstance()->user_wallpaper_delegate()); 120 WmShell::Get()->wallpaper_delegate());
120 controller_->set_wallpaper_reload_delay_for_test(0); 121 controller_->set_wallpaper_reload_delay_for_test(0);
121 } 122 }
122 123
123 DesktopBackgroundView* desktop_background_view() { 124 DesktopBackgroundView* desktop_background_view() {
124 DesktopBackgroundWidgetController* controller = 125 DesktopBackgroundWidgetController* controller =
125 Shell::GetPrimaryRootWindowController() 126 Shell::GetPrimaryRootWindowController()
126 ->animating_wallpaper_controller() 127 ->animating_wallpaper_controller()
127 ->GetController(false); 128 ->GetController(false);
128 EXPECT_TRUE(controller); 129 EXPECT_TRUE(controller);
129 return static_cast<DesktopBackgroundView*>( 130 return static_cast<DesktopBackgroundView*>(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 DesktopBackgroundWidgetController* controller = 182 DesktopBackgroundWidgetController* controller =
182 Shell::GetPrimaryRootWindowController() 183 Shell::GetPrimaryRootWindowController()
183 ->animating_wallpaper_controller() 184 ->animating_wallpaper_controller()
184 ->GetController(false); 185 ->GetController(false);
185 EXPECT_TRUE(controller); 186 EXPECT_TRUE(controller);
186 ASSERT_NO_FATAL_FAILURE(RunAnimationForWidget(controller->widget())); 187 ASSERT_NO_FATAL_FAILURE(RunAnimationForWidget(controller->widget()));
187 } 188 }
188 189
189 DesktopBackgroundController* controller_; // Not owned. 190 DesktopBackgroundController* controller_; // Not owned.
190 191
191 test::TestUserWallpaperDelegate* wallpaper_delegate_; 192 test::TestWallpaperDelegate* wallpaper_delegate_;
192 193
193 private: 194 private:
194 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundControllerTest); 195 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundControllerTest);
195 }; 196 };
196 197
197 TEST_F(DesktopBackgroundControllerTest, BasicReparenting) { 198 TEST_F(DesktopBackgroundControllerTest, BasicReparenting) {
198 DesktopBackgroundController* controller = 199 DesktopBackgroundController* controller =
199 Shell::GetInstance()->desktop_background_controller(); 200 Shell::GetInstance()->desktop_background_controller();
200 controller->CreateEmptyWallpaper(); 201 controller->CreateEmptyWallpaper();
201 202
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 { 489 {
489 SCOPED_TRACE(base::StringPrintf("1200x600/u@1.5 low resolution")); 490 SCOPED_TRACE(base::StringPrintf("1200x600/u@1.5 low resolution"));
490 controller_->SetWallpaperImage(image_low_res, WALLPAPER_LAYOUT_CENTER); 491 controller_->SetWallpaperImage(image_low_res, WALLPAPER_LAYOUT_CENTER);
491 WallpaperFitToNativeResolution( 492 WallpaperFitToNativeResolution(
492 desktop_background_view(), low_dsf, low_resolution.width(), 493 desktop_background_view(), low_dsf, low_resolution.width(),
493 low_resolution.height(), kCustomWallpaperColor); 494 low_resolution.height(), kCustomWallpaperColor);
494 } 495 }
495 } 496 }
496 497
497 } // namespace ash 498 } // namespace ash
OLDNEW
« no previous file with comments | « ash/desktop_background/desktop_background_controller.cc ('k') | ash/desktop_background/desktop_background_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698