| Index: ash/system/overview/overview_button_tray_unittest.cc
|
| diff --git a/ash/system/overview/overview_button_tray_unittest.cc b/ash/system/overview/overview_button_tray_unittest.cc
|
| index a752f13e02b80941c0b312f7aa142f2b47eb34e0..62e8e767424e726c58105c0794278384418b55ca 100644
|
| --- a/ash/system/overview/overview_button_tray_unittest.cc
|
| +++ b/ash/system/overview/overview_button_tray_unittest.cc
|
| @@ -4,14 +4,15 @@
|
|
|
| #include "ash/system/overview/overview_button_tray.h"
|
|
|
| +#include "ash/display/window_tree_host_manager.h"
|
| #include "ash/login_status.h"
|
| #include "ash/public/cpp/config.h"
|
| #include "ash/public/cpp/shelf_types.h"
|
| #include "ash/root_window_controller.h"
|
| -#include "ash/rotator/screen_rotation_animator.h"
|
| #include "ash/session/session_controller.h"
|
| #include "ash/shell.h"
|
| #include "ash/shell_port.h"
|
| +#include "ash/system/overview/test/overview_button_tray_test_api.h"
|
| #include "ash/system/status_area_widget.h"
|
| #include "ash/test/ash_test_base.h"
|
| #include "ash/test/ash_test_helper.h"
|
| @@ -30,6 +31,7 @@
|
| #include "ui/events/event_constants.h"
|
| #include "ui/events/gestures/gesture_types.h"
|
| #include "ui/views/controls/image_view.h"
|
| +#include "ui/wm/core/window_util.h"
|
|
|
| namespace ash {
|
|
|
| @@ -209,11 +211,42 @@ TEST_F(OverviewButtonTrayTest, ActiveStateOnlyDuringOverviewMode) {
|
| EXPECT_FALSE(GetTray()->is_active());
|
| }
|
|
|
| -// Test that when a hide animation is aborted via deletion, that the
|
| -// OverviewButton is still hidden.
|
| +// Test that a hide animation can complete.
|
| TEST_F(OverviewButtonTrayTest, HideAnimationAlwaysCompletes) {
|
| - // TODO: disabled as ScreenRotationAnimator does not work in mash,
|
| - // http://crbug.com/696754.
|
| + Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
|
| + true);
|
| + EXPECT_TRUE(GetTray()->visible());
|
| + GetTray()->SetVisible(false);
|
| + EXPECT_FALSE(GetTray()->visible());
|
| +}
|
| +
|
| +// Test that when a hide animation is aborted, the OverviewButton is still
|
| +// hidden.
|
| +TEST_F(OverviewButtonTrayTest, HideAnimationAlwaysCompletesOnAbort) {
|
| + Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
|
| + true);
|
| +
|
| + // Long duration for hide animation, to allow it to be interrupted.
|
| + std::unique_ptr<ui::ScopedAnimationDurationScaleMode> hide_duration(
|
| + new ui::ScopedAnimationDurationScaleMode(
|
| + ui::ScopedAnimationDurationScaleMode::SLOW_DURATION));
|
| + GetTray()->SetVisible(false);
|
| +
|
| + // Abort the animation.
|
| + std::unique_ptr<ui::ScopedAnimationDurationScaleMode> rotate_duration(
|
| + new ui::ScopedAnimationDurationScaleMode(
|
| + ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
|
| + test::OverviewButtonTrayTestApi(GetTray()).AbortAllAnimations();
|
| +
|
| + RunAllPendingInMessageLoop();
|
| + EXPECT_FALSE(GetTray()->visible());
|
| +}
|
| +
|
| +// Test that when a hide animation is aborted via deletion, the
|
| +// OverviewButton is still hidden.
|
| +TEST_F(OverviewButtonTrayTest, HideAnimationAlwaysCompletesOnDelete) {
|
| + // TODO(wutao): disabled as GetRootWindowForDisplayId does not work in mash,
|
| + // http://crbug.com/706589.
|
| if (Shell::GetAshConfig() == Config::MASH)
|
| return;
|
|
|
| @@ -226,14 +259,16 @@ TEST_F(OverviewButtonTrayTest, HideAnimationAlwaysCompletes) {
|
| ui::ScopedAnimationDurationScaleMode::SLOW_DURATION));
|
| GetTray()->SetVisible(false);
|
|
|
| - // ScreenRotationAnimator copies the current layers, and deletes them upon
|
| - // completion. Allow its animation to complete first.
|
| + // Clone old layers and delete them. This will abort the animation.
|
| std::unique_ptr<ui::ScopedAnimationDurationScaleMode> rotate_duration(
|
| new ui::ScopedAnimationDurationScaleMode(
|
| ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
|
| - ash::ScreenRotationAnimator(display::Display::InternalDisplayId())
|
| - .Rotate(display::Display::ROTATE_270,
|
| - display::Display::ROTATION_SOURCE_ACTIVE);
|
| + aura::Window* root_window =
|
| + Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId(
|
| + display::Screen::GetScreen()->GetPrimaryDisplay().id());
|
| + std::unique_ptr<ui::LayerTreeOwner> old_layer_tree_owner =
|
| + ::wm::RecreateLayers(root_window);
|
| + old_layer_tree_owner.reset();
|
|
|
| RunAllPendingInMessageLoop();
|
| EXPECT_FALSE(GetTray()->visible());
|
|
|