Commit 3106d6b7 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

overview: Re-enable two tests.

- OverviewGridTest.SnappedWindow
- SplitViewOverviewSessionTest.OverviewDragControllerBehavior.

Test: ash_unittests *Overview*
Bug: none
Change-Id: Iec84d264f6f572cf8f84a16ed597e00bc0b2995d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1992019
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarAvery Musbach <amusbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729965}
parent aa47dc0a
......@@ -7,7 +7,9 @@
#include "ash/screen_util.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/overview/overview_item.h"
#include "ash/wm/overview/overview_test_util.h"
#include "ash/wm/splitview/split_view_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/window_state.h"
......@@ -258,14 +260,12 @@ TEST_F(OverviewGridTest, FullyOffscreenWindow) {
// Tests that only one window animates when entering overview from splitview
// double snapped.
// TODO(sammiequon): The way this test is setup causes an unnatural state by
// calling |GetGridBoundsInScreen| with split view state both snapped. Find a
// way to re-enable this.
TEST_F(OverviewGridTest, DISABLED_SnappedWindow) {
TEST_F(OverviewGridTest, SnappedWindow) {
auto window1 = CreateTestWindow(gfx::Rect(100, 100));
auto window2 = CreateTestWindow(gfx::Rect(100, 100));
auto window3 = CreateTestWindow(gfx::Rect(100, 100));
wm::ActivateWindow(window1.get());
wm::ActivateWindow(window2.get());
Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true);
split_view_controller()->SnapWindow(window1.get(), SplitViewController::LEFT);
......@@ -275,13 +275,19 @@ TEST_F(OverviewGridTest, DISABLED_SnappedWindow) {
SplitViewController::RIGHT);
EXPECT_TRUE(WindowState::Get(window3.get())->IsMaximized());
// We cannot create a grid object like in the other tests because creating a
// grid calls |GetGridBoundsInScreen| with split view state both snapped which
// is an unnatural state.
Shell::Get()->overview_controller()->StartOverview(
OverviewSession::EnterExitOverviewType::kNormal);
// Tests that |window3| is not animated even though its bounds are larger than
// |window2| because it is fully occluded by |window1| + |window2| and the
// split view divider.
std::vector<gfx::RectF> target_bounds = {gfx::RectF(100.f, 100.f),
gfx::RectF(100.f, 100.f)};
CheckAnimationStates({window2.get(), window3.get()}, target_bounds,
{true, false}, {true, false});
OverviewItem* item2 = GetOverviewItemForWindow(window2.get());
OverviewItem* item3 = GetOverviewItemForWindow(window3.get());
EXPECT_TRUE(item2->should_animate_when_entering());
EXPECT_FALSE(item3->should_animate_when_entering());
}
} // namespace ash
......@@ -3700,12 +3700,13 @@ TEST_P(SplitViewOverviewSessionTest, DragOverviewWindowToSnap) {
// Verify the correct behavior when dragging windows in overview mode.
TEST_P(SplitViewOverviewSessionTest, OverviewDragControllerBehavior) {
// TODO(sammiequon): Make this work once this feature is enabled by default
// for good.
if (base::FeatureList::IsEnabled(features::kNewOverviewLayout))
if (!base::FeatureList::IsEnabled(features::kNewOverviewLayout))
return;
aura::Env::GetInstance()->set_throttle_input_on_resize_for_testing(false);
ui::GestureConfiguration* gesture_config =
ui::GestureConfiguration::GetInstance();
gesture_config->set_long_press_time_in_ms(1);
gesture_config->set_show_press_delay_in_ms(1);
std::unique_ptr<aura::Window> window1 = CreateTestWindow();
std::unique_ptr<aura::Window> window2 = CreateTestWindow();
......@@ -3723,9 +3724,18 @@ TEST_P(SplitViewOverviewSessionTest, OverviewDragControllerBehavior) {
generator->set_current_screen_location(
gfx::ToRoundedPoint(window_item1->target_bounds().CenterPoint()));
generator->PressTouch();
// Simulate a long press, which is required to snap windows.
base::RunLoop run_loop;
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, run_loop.QuitClosure(), base::TimeDelta::FromMilliseconds(2));
run_loop.Run();
OverviewWindowDragController* drag_controller =
overview_session()->window_drag_controller();
EXPECT_EQ(DragBehavior::kUndefined, drag_controller->current_drag_behavior());
ASSERT_TRUE(drag_controller);
EXPECT_EQ(DragBehavior::kNormalDrag,
drag_controller->current_drag_behavior());
generator->MoveTouchBy(20, 0);
EXPECT_EQ(DragBehavior::kNormalDrag,
drag_controller->current_drag_behavior());
......@@ -3737,12 +3747,13 @@ TEST_P(SplitViewOverviewSessionTest, OverviewDragControllerBehavior) {
generator->set_current_screen_location(
gfx::ToRoundedPoint(window_item2->target_bounds().CenterPoint()));
generator->PressTouch();
drag_controller = overview_session()->window_drag_controller();
EXPECT_EQ(DragBehavior::kUndefined, drag_controller->current_drag_behavior());
// Use small increments otherwise a fling event will be fired.
for (int j = 0; j < 20; ++j)
generator->MoveTouchBy(0, 1);
// A new instance of drag controller gets created each time a drag starts.
drag_controller = overview_session()->window_drag_controller();
EXPECT_EQ(DragBehavior::kDragToClose,
drag_controller->current_drag_behavior());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment