| 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/common/ash_switches.h" | |
| 11 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| 12 #include "ash/desktop_background/desktop_background_view.h" | 11 #include "ash/desktop_background/desktop_background_view.h" |
| 13 #include "ash/desktop_background/desktop_background_widget_controller.h" | 12 #include "ash/desktop_background/desktop_background_widget_controller.h" |
| 14 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
| 15 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 16 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
| 17 #include "ash/test/test_user_wallpaper_delegate.h" | 16 #include "ash/test/test_user_wallpaper_delegate.h" |
| 18 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 19 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
| 20 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 21 #include "base/threading/sequenced_worker_pool.h" | 20 #include "base/threading/sequenced_worker_pool.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | |
| 23 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| 24 #include "third_party/skia/include/core/SkColor.h" | 22 #include "third_party/skia/include/core/SkColor.h" |
| 25 #include "ui/aura/window_event_dispatcher.h" | |
| 26 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 23 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 27 #include "ui/compositor/test/layer_animator_test_controller.h" | 24 #include "ui/compositor/test/layer_animator_test_controller.h" |
| 28 #include "ui/gfx/canvas.h" | 25 #include "ui/gfx/canvas.h" |
| 29 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
| 30 | 27 |
| 31 using aura::RootWindow; | |
| 32 using aura::Window; | |
| 33 using wallpaper::WallpaperLayout; | |
| 34 using wallpaper::WALLPAPER_LAYOUT_CENTER; | 28 using wallpaper::WALLPAPER_LAYOUT_CENTER; |
| 35 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; | 29 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; |
| 36 using wallpaper::WALLPAPER_LAYOUT_STRETCH; | 30 using wallpaper::WALLPAPER_LAYOUT_STRETCH; |
| 37 using wallpaper::WALLPAPER_LAYOUT_TILE; | 31 using wallpaper::WALLPAPER_LAYOUT_TILE; |
| 38 | 32 |
| 39 namespace ash { | 33 namespace ash { |
| 40 namespace { | 34 namespace { |
| 41 | 35 |
| 42 // Containers IDs used for tests. | 36 // Containers IDs used for tests. |
| 43 const int kDesktopBackgroundId = ash::kShellWindowId_DesktopBackgroundContainer; | 37 const int kDesktopBackgroundId = ash::kShellWindowId_DesktopBackgroundContainer; |
| 44 const int kLockScreenBackgroundId = | 38 const int kLockScreenBackgroundId = |
| 45 ash::kShellWindowId_LockScreenBackgroundContainer; | 39 ash::kShellWindowId_LockScreenBackgroundContainer; |
| 46 | 40 |
| 47 // Returns number of child windows in a shell window container. | 41 // Returns number of child windows in a shell window container. |
| 48 int ChildCountForContainer(int container_id) { | 42 int ChildCountForContainer(int container_id) { |
| 49 Window* root = ash::Shell::GetPrimaryRootWindow(); | 43 aura::Window* root = ash::Shell::GetPrimaryRootWindow(); |
| 50 Window* container = root->GetChildById(container_id); | 44 aura::Window* container = root->GetChildById(container_id); |
| 51 return static_cast<int>(container->children().size()); | 45 return static_cast<int>(container->children().size()); |
| 52 } | 46 } |
| 53 | 47 |
| 54 // Steps a widget's layer animation until it is completed. Animations must be | 48 // Steps a widget's layer animation until it is completed. Animations must be |
| 55 // enabled. | 49 // enabled. |
| 56 void RunAnimationForWidget(views::Widget* widget) { | 50 void RunAnimationForWidget(views::Widget* widget) { |
| 57 // Animations must be enabled for stepping to work. | 51 // Animations must be enabled for stepping to work. |
| 58 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), | 52 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(), |
| 59 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); | 53 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); |
| 60 | 54 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 { | 488 { |
| 495 SCOPED_TRACE(base::StringPrintf("1200x600/u@1.5 low resolution")); | 489 SCOPED_TRACE(base::StringPrintf("1200x600/u@1.5 low resolution")); |
| 496 controller_->SetWallpaperImage(image_low_res, WALLPAPER_LAYOUT_CENTER); | 490 controller_->SetWallpaperImage(image_low_res, WALLPAPER_LAYOUT_CENTER); |
| 497 WallpaperFitToNativeResolution( | 491 WallpaperFitToNativeResolution( |
| 498 desktop_background_view(), low_dsf, low_resolution.width(), | 492 desktop_background_view(), low_dsf, low_resolution.width(), |
| 499 low_resolution.height(), kCustomWallpaperColor); | 493 low_resolution.height(), kCustomWallpaperColor); |
| 500 } | 494 } |
| 501 } | 495 } |
| 502 | 496 |
| 503 } // namespace ash | 497 } // namespace ash |
| OLD | NEW |