| Index: ash/wm/system_gesture_event_filter_unittest.cc
|
| diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc
|
| index bba9d01b7a47ab312bbadc0e168eb33bf00dfa09..7e7a86f62a991dec9b517e9b1f23533b98442a4b 100644
|
| --- a/ash/wm/system_gesture_event_filter_unittest.cc
|
| +++ b/ash/wm/system_gesture_event_filter_unittest.cc
|
| @@ -63,6 +63,7 @@ class ResizableWidgetDelegate : public views::WidgetDelegateView {
|
| class MaxSizeNCFV : public views::NonClientFrameView {
|
| public:
|
| MaxSizeNCFV() {}
|
| +
|
| private:
|
| gfx::Size GetMaximumSize() const override { return gfx::Size(200, 200); }
|
| gfx::Rect GetBoundsForClientView() const override { return gfx::Rect(); };
|
| @@ -104,7 +105,7 @@ class MaxSizeWidgetDelegate : public views::WidgetDelegateView {
|
| DISALLOW_COPY_AND_ASSIGN(MaxSizeWidgetDelegate);
|
| };
|
|
|
| -} // namespace
|
| +} // namespace
|
|
|
| class SystemGestureEventFilterTest : public AshTestBase {
|
| public:
|
| @@ -124,8 +125,8 @@ class SystemGestureEventFilterTest : public AshTestBase {
|
| trailing.push_back(views::FRAME_BUTTON_MINIMIZE);
|
| trailing.push_back(views::FRAME_BUTTON_MAXIMIZE);
|
| trailing.push_back(views::FRAME_BUTTON_CLOSE);
|
| - views::WindowButtonOrderProvider::GetInstance()->
|
| - SetWindowButtonOrder(leading, trailing);
|
| + views::WindowButtonOrderProvider::GetInstance()->SetWindowButtonOrder(
|
| + leading, trailing);
|
|
|
| test::AshTestBase::SetUp();
|
| // Enable brightness key.
|
| @@ -156,8 +157,7 @@ TEST_F(SystemGestureEventFilterTest, TwoFingerDrag) {
|
| const int kSteps = 15;
|
| const int kTouchPoints = 2;
|
| gfx::Point points[kTouchPoints] = {
|
| - gfx::Point(250, 250),
|
| - gfx::Point(350, 350),
|
| + gfx::Point(250, 250), gfx::Point(350, 350),
|
| };
|
|
|
| ui::test::EventGenerator generator(root_window, toplevel->GetNativeWindow());
|
| @@ -191,7 +191,7 @@ TEST_F(SystemGestureEventFilterTest, TwoFingerDrag) {
|
| left_points[i].Offset(right_tile_bounds.x(), right_tile_bounds.y());
|
| }
|
| generator.GestureMultiFingerScroll(kTouchPoints, left_points, 15, kSteps,
|
| - -150, 0);
|
| + -150, 0);
|
| gfx::Rect left_tile_bounds = toplevel->GetWindowBoundsInScreen();
|
| EXPECT_NE(normal_bounds.ToString(), left_tile_bounds.ToString());
|
| EXPECT_NE(right_tile_bounds.ToString(), left_tile_bounds.ToString());
|
| @@ -213,8 +213,8 @@ TEST_F(SystemGestureEventFilterTest, WindowsWithMaxSizeDontSnap) {
|
| const int kSteps = 15;
|
| const int kTouchPoints = 2;
|
| gfx::Point points[kTouchPoints] = {
|
| - gfx::Point(bounds.x() + 10, bounds.y() + 30),
|
| - gfx::Point(bounds.x() + 30, bounds.y() + 20),
|
| + gfx::Point(bounds.x() + 10, bounds.y() + 30),
|
| + gfx::Point(bounds.x() + 30, bounds.y() + 20),
|
| };
|
|
|
| ui::test::EventGenerator generator(root_window, toplevel->GetNativeWindow());
|
| @@ -240,7 +240,7 @@ TEST_F(SystemGestureEventFilterTest, WindowsWithMaxSizeDontSnap) {
|
| generator.GestureMultiFingerScroll(kTouchPoints, points, 15, kSteps, 150, 0);
|
| normal_bounds.set_x(normal_bounds.x() + 150);
|
| EXPECT_EQ(normal_bounds.ToString(),
|
| - toplevel->GetWindowBoundsInScreen().ToString());
|
| + toplevel->GetWindowBoundsInScreen().ToString());
|
|
|
| toplevel->GetNativeWindow()->SetBounds(bounds);
|
|
|
| @@ -249,7 +249,7 @@ TEST_F(SystemGestureEventFilterTest, WindowsWithMaxSizeDontSnap) {
|
| generator.GestureMultiFingerScroll(kTouchPoints, points, 15, kSteps, -150, 0);
|
| normal_bounds.set_x(normal_bounds.x() - 150);
|
| EXPECT_EQ(normal_bounds.ToString(),
|
| - toplevel->GetWindowBoundsInScreen().ToString());
|
| + toplevel->GetWindowBoundsInScreen().ToString());
|
|
|
| toplevel->GetNativeWindow()->SetBounds(bounds);
|
|
|
| @@ -258,7 +258,7 @@ TEST_F(SystemGestureEventFilterTest, WindowsWithMaxSizeDontSnap) {
|
| normal_bounds.set_x(normal_bounds.x() + 150);
|
| generator.GestureMultiFingerScroll(kTouchPoints, points, 15, kSteps, 150, 0);
|
| EXPECT_EQ(normal_bounds.ToString(),
|
| - toplevel->GetWindowBoundsInScreen().ToString());
|
| + toplevel->GetWindowBoundsInScreen().ToString());
|
| }
|
|
|
| TEST_F(SystemGestureEventFilterTest, DISABLED_TwoFingerDragEdge) {
|
| @@ -271,14 +271,16 @@ TEST_F(SystemGestureEventFilterTest, DISABLED_TwoFingerDragEdge) {
|
| const int kSteps = 15;
|
| const int kTouchPoints = 2;
|
| gfx::Point points[kTouchPoints] = {
|
| - gfx::Point(30, 20), // Caption
|
| - gfx::Point(0, 40), // Left edge
|
| + gfx::Point(30, 20), // Caption
|
| + gfx::Point(0, 40), // Left edge
|
| };
|
|
|
| - EXPECT_EQ(HTCAPTION, toplevel->GetNativeWindow()->delegate()->
|
| - GetNonClientComponent(points[0]));
|
| - EXPECT_EQ(HTLEFT, toplevel->GetNativeWindow()->delegate()->
|
| - GetNonClientComponent(points[1]));
|
| + EXPECT_EQ(HTCAPTION,
|
| + toplevel->GetNativeWindow()->delegate()->GetNonClientComponent(
|
| + points[0]));
|
| + EXPECT_EQ(HTLEFT,
|
| + toplevel->GetNativeWindow()->delegate()->GetNonClientComponent(
|
| + points[1]));
|
|
|
| ui::test::EventGenerator generator(root_window, toplevel->GetNativeWindow());
|
|
|
| @@ -295,16 +297,15 @@ TEST_F(SystemGestureEventFilterTest, DISABLED_TwoFingerDragEdge) {
|
| TEST_F(SystemGestureEventFilterTest,
|
| TwoFingerAttemptResizeLeftAndRightEdgesSimultaneously) {
|
| gfx::Rect initial_bounds(0, 0, 400, 400);
|
| - views::Widget* toplevel =
|
| - views::Widget::CreateWindowWithContextAndBounds(
|
| - new ResizableWidgetDelegate, CurrentContext(), initial_bounds);
|
| + views::Widget* toplevel = views::Widget::CreateWindowWithContextAndBounds(
|
| + new ResizableWidgetDelegate, CurrentContext(), initial_bounds);
|
| toplevel->Show();
|
|
|
| const int kSteps = 15;
|
| const int kTouchPoints = 2;
|
| gfx::Point points[kTouchPoints] = {
|
| - gfx::Point(0, 40), // Left edge
|
| - gfx::Point(399, 40), // Right edge
|
| + gfx::Point(0, 40), // Left edge
|
| + gfx::Point(399, 40), // Right edge
|
| };
|
| int delays[kTouchPoints] = {0, 120};
|
|
|
| @@ -330,15 +331,17 @@ TEST_F(SystemGestureEventFilterTest, TwoFingerDragDelayed) {
|
| const int kSteps = 15;
|
| const int kTouchPoints = 2;
|
| gfx::Point points[kTouchPoints] = {
|
| - gfx::Point(30, 20), // Caption
|
| - gfx::Point(34, 20), // Caption
|
| + gfx::Point(30, 20), // Caption
|
| + gfx::Point(34, 20), // Caption
|
| };
|
| int delays[kTouchPoints] = {0, 120};
|
|
|
| - EXPECT_EQ(HTCAPTION, toplevel->GetNativeWindow()->delegate()->
|
| - GetNonClientComponent(points[0]));
|
| - EXPECT_EQ(HTCAPTION, toplevel->GetNativeWindow()->delegate()->
|
| - GetNonClientComponent(points[1]));
|
| + EXPECT_EQ(HTCAPTION,
|
| + toplevel->GetNativeWindow()->delegate()->GetNonClientComponent(
|
| + points[0]));
|
| + EXPECT_EQ(HTCAPTION,
|
| + toplevel->GetNativeWindow()->delegate()->GetNonClientComponent(
|
| + points[1]));
|
|
|
| ui::test::EventGenerator generator(root_window, toplevel->GetNativeWindow());
|
|
|
| @@ -347,8 +350,8 @@ TEST_F(SystemGestureEventFilterTest, TwoFingerDragDelayed) {
|
| // Add another finger after 120ms and continue dragging.
|
| // The window should move and the drag should be determined by the center
|
| // point between the fingers.
|
| - generator.GestureMultiFingerScrollWithDelays(
|
| - kTouchPoints, points, delays, 15, kSteps, 150, 150);
|
| + generator.GestureMultiFingerScrollWithDelays(kTouchPoints, points, delays, 15,
|
| + kSteps, 150, 150);
|
| bounds += gfx::Vector2d(150 + (points[1].x() - points[0].x()) / 2, 150);
|
| EXPECT_EQ(bounds.ToString(),
|
| toplevel->GetNativeWindow()->bounds().ToString());
|
| @@ -364,16 +367,18 @@ TEST_F(SystemGestureEventFilterTest, ThreeFingerGestureStopsDrag) {
|
| const int kSteps = 10;
|
| const int kTouchPoints = 3;
|
| gfx::Point points[kTouchPoints] = {
|
| - gfx::Point(30, 20), // Caption
|
| - gfx::Point(34, 20), // Caption
|
| - gfx::Point(38, 20), // Caption
|
| + gfx::Point(30, 20), // Caption
|
| + gfx::Point(34, 20), // Caption
|
| + gfx::Point(38, 20), // Caption
|
| };
|
| int delays[kTouchPoints] = {0, 0, 120};
|
|
|
| - EXPECT_EQ(HTCAPTION, toplevel->GetNativeWindow()->delegate()->
|
| - GetNonClientComponent(points[0]));
|
| - EXPECT_EQ(HTCAPTION, toplevel->GetNativeWindow()->delegate()->
|
| - GetNonClientComponent(points[1]));
|
| + EXPECT_EQ(HTCAPTION,
|
| + toplevel->GetNativeWindow()->delegate()->GetNonClientComponent(
|
| + points[0]));
|
| + EXPECT_EQ(HTCAPTION,
|
| + toplevel->GetNativeWindow()->delegate()->GetNonClientComponent(
|
| + points[1]));
|
|
|
| ui::test::EventGenerator generator(root_window, toplevel->GetNativeWindow());
|
|
|
| @@ -400,8 +405,8 @@ TEST_F(SystemGestureEventFilterTest, DragLeftNearEdgeSnaps) {
|
| const int kSteps = 15;
|
| const int kTouchPoints = 2;
|
| gfx::Point points[kTouchPoints] = {
|
| - gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5),
|
| - gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5),
|
| + gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5),
|
| + gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5),
|
| };
|
| aura::Window* toplevel_window = toplevel->GetNativeWindow();
|
| ui::test::EventGenerator generator(root_window, toplevel_window);
|
| @@ -411,8 +416,8 @@ TEST_F(SystemGestureEventFilterTest, DragLeftNearEdgeSnaps) {
|
| ->GetDisplayNearestWindow(root_window)
|
| .work_area();
|
| int drag_x = work_area.x() + 20 - points[0].x();
|
| - generator.GestureMultiFingerScroll(
|
| - kTouchPoints, points, 120, kSteps, drag_x, 0);
|
| + generator.GestureMultiFingerScroll(kTouchPoints, points, 120, kSteps, drag_x,
|
| + 0);
|
|
|
| EXPECT_EQ(ash::wm::GetDefaultLeftSnappedWindowBoundsInParent(
|
| ash::WmWindowAura::Get(toplevel_window))
|
| @@ -430,8 +435,8 @@ TEST_F(SystemGestureEventFilterTest, DragRightNearEdgeSnaps) {
|
| const int kSteps = 15;
|
| const int kTouchPoints = 2;
|
| gfx::Point points[kTouchPoints] = {
|
| - gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5),
|
| - gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5),
|
| + gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5),
|
| + gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5),
|
| };
|
| aura::Window* toplevel_window = toplevel->GetNativeWindow();
|
| ui::test::EventGenerator generator(root_window, toplevel_window);
|
| @@ -441,8 +446,8 @@ TEST_F(SystemGestureEventFilterTest, DragRightNearEdgeSnaps) {
|
| ->GetDisplayNearestWindow(root_window)
|
| .work_area();
|
| int drag_x = work_area.right() - 20 - points[0].x();
|
| - generator.GestureMultiFingerScroll(
|
| - kTouchPoints, points, 120, kSteps, drag_x, 0);
|
| + generator.GestureMultiFingerScroll(kTouchPoints, points, 120, kSteps, drag_x,
|
| + 0);
|
| EXPECT_EQ(wm::GetDefaultRightSnappedWindowBoundsInParent(
|
| WmWindowAura::Get(toplevel_window))
|
| .ToString(),
|
|
|