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

Side by Side Diff: ash/wm/gestures/overview_gesture_handler_unittest.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « ash/wm/gestures/overview_gesture_handler.cc ('k') | ash/wm/gestures/shelf_gesture_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/wm/overview/window_selector_controller.h" 5 #include "ash/common/wm/overview/window_selector_controller.h"
6 #include "ash/common/wm_shell.h" 6 #include "ash/common/wm_shell.h"
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ui/aura/test/test_window_delegate.h" 10 #include "ui/aura/test/test_window_delegate.h"
(...skipping 26 matching lines...) Expand all
37 37
38 // Tests a swipe up with three fingers to enter and a swipe down to exit 38 // Tests a swipe up with three fingers to enter and a swipe down to exit
39 // overview. 39 // overview.
40 TEST_F(OverviewGestureHandlerTest, VerticalSwipes) { 40 TEST_F(OverviewGestureHandlerTest, VerticalSwipes) {
41 gfx::Rect bounds(0, 0, 400, 400); 41 gfx::Rect bounds(0, 0, 400, 400);
42 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 42 aura::Window* root_window = Shell::GetPrimaryRootWindow();
43 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); 43 std::unique_ptr<aura::Window> window1(CreateWindow(bounds));
44 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); 44 std::unique_ptr<aura::Window> window2(CreateWindow(bounds));
45 ui::test::EventGenerator generator(root_window, root_window); 45 ui::test::EventGenerator generator(root_window, root_window);
46 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5), 46 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5),
47 0, -500, 100, 3); 47 0, -500, 100, 3);
48 EXPECT_TRUE(IsSelecting()); 48 EXPECT_TRUE(IsSelecting());
49 49
50 // Swiping up again does nothing. 50 // Swiping up again does nothing.
51 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5), 51 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5),
52 0, -500, 100, 3); 52 0, -500, 100, 3);
53 EXPECT_TRUE(IsSelecting()); 53 EXPECT_TRUE(IsSelecting());
54 54
55 // Swiping down exits. 55 // Swiping down exits.
56 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5), 56 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5),
57 0, 500, 100, 3); 57 0, 500, 100, 3);
58 EXPECT_FALSE(IsSelecting()); 58 EXPECT_FALSE(IsSelecting());
59 59
60 // Swiping down again does nothing. 60 // Swiping down again does nothing.
61 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5), 61 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5),
62 0, 500, 100, 3); 62 0, 500, 100, 3);
63 EXPECT_FALSE(IsSelecting()); 63 EXPECT_FALSE(IsSelecting());
64 } 64 }
65 65
66 // Tests that a mostly horizontal swipe does not trigger overview. 66 // Tests that a mostly horizontal swipe does not trigger overview.
67 TEST_F(OverviewGestureHandlerTest, HorizontalSwipes) { 67 TEST_F(OverviewGestureHandlerTest, HorizontalSwipes) {
68 gfx::Rect bounds(0, 0, 400, 400); 68 gfx::Rect bounds(0, 0, 400, 400);
69 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 69 aura::Window* root_window = Shell::GetPrimaryRootWindow();
70 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); 70 std::unique_ptr<aura::Window> window1(CreateWindow(bounds));
71 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); 71 std::unique_ptr<aura::Window> window2(CreateWindow(bounds));
72 ui::test::EventGenerator generator(root_window, root_window); 72 ui::test::EventGenerator generator(root_window, root_window);
73 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5), 73 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5),
74 600, -500, 100, 3); 74 600, -500, 100, 3);
75 EXPECT_FALSE(IsSelecting()); 75 EXPECT_FALSE(IsSelecting());
76 76
77 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5), 77 generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5),
78 -600, -500, 100, 3); 78 -600, -500, 100, 3);
79 EXPECT_FALSE(IsSelecting()); 79 EXPECT_FALSE(IsSelecting());
80 } 80 }
81 81
82 // Tests a swipe up with three fingers without releasing followed by a swipe 82 // Tests a swipe up with three fingers without releasing followed by a swipe
83 // down by a lesser amount which should still be enough to exit. 83 // down by a lesser amount which should still be enough to exit.
84 TEST_F(OverviewGestureHandlerTest, SwipeUpDownWithoutReleasing) { 84 TEST_F(OverviewGestureHandlerTest, SwipeUpDownWithoutReleasing) {
85 gfx::Rect bounds(0, 0, 400, 400); 85 gfx::Rect bounds(0, 0, 400, 400);
86 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 86 aura::Window* root_window = Shell::GetPrimaryRootWindow();
87 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); 87 std::unique_ptr<aura::Window> window1(CreateWindow(bounds));
88 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); 88 std::unique_ptr<aura::Window> window2(CreateWindow(bounds));
89 ui::test::EventGenerator generator(root_window, root_window); 89 ui::test::EventGenerator generator(root_window, root_window);
90 base::TimeTicks timestamp = base::TimeTicks::Now(); 90 base::TimeTicks timestamp = base::TimeTicks::Now();
91 gfx::Point start; 91 gfx::Point start;
92 int num_fingers = 3; 92 int num_fingers = 3;
93 base::TimeDelta step_delay(base::TimeDelta::FromMilliseconds(5)); 93 base::TimeDelta step_delay(base::TimeDelta::FromMilliseconds(5));
94 ui::ScrollEvent fling_cancel(ui::ET_SCROLL_FLING_CANCEL, 94 ui::ScrollEvent fling_cancel(ui::ET_SCROLL_FLING_CANCEL, start, timestamp, 0,
95 start, 95 0, 0, 0, 0, num_fingers);
96 timestamp,
97 0,
98 0, 0,
99 0, 0,
100 num_fingers);
101 generator.Dispatch(&fling_cancel); 96 generator.Dispatch(&fling_cancel);
102 97
103 // Scroll up by 1000px. 98 // Scroll up by 1000px.
104 for (int i = 0; i < 100; ++i) { 99 for (int i = 0; i < 100; ++i) {
105 timestamp += step_delay; 100 timestamp += step_delay;
106 ui::ScrollEvent move(ui::ET_SCROLL, 101 ui::ScrollEvent move(ui::ET_SCROLL, start, timestamp, 0, 0, -10, 0, -10,
107 start,
108 timestamp,
109 0,
110 0, -10,
111 0, -10,
112 num_fingers); 102 num_fingers);
113 generator.Dispatch(&move); 103 generator.Dispatch(&move);
114 } 104 }
115 105
116 EXPECT_TRUE(IsSelecting()); 106 EXPECT_TRUE(IsSelecting());
117 107
118 // Without releasing scroll back down by 600px. 108 // Without releasing scroll back down by 600px.
119 for (int i = 0; i < 60; ++i) { 109 for (int i = 0; i < 60; ++i) {
120 timestamp += step_delay; 110 timestamp += step_delay;
121 ui::ScrollEvent move(ui::ET_SCROLL, 111 ui::ScrollEvent move(ui::ET_SCROLL, start, timestamp, 0, 0, 10, 0, 10,
122 start,
123 timestamp,
124 0,
125 0, 10,
126 0, 10,
127 num_fingers); 112 num_fingers);
128 generator.Dispatch(&move); 113 generator.Dispatch(&move);
129 } 114 }
130 115
131 EXPECT_FALSE(IsSelecting()); 116 EXPECT_FALSE(IsSelecting());
132 ui::ScrollEvent fling_start(ui::ET_SCROLL_FLING_START, 117 ui::ScrollEvent fling_start(ui::ET_SCROLL_FLING_START, start, timestamp, 0, 0,
133 start, 118 10, 0, 10, num_fingers);
134 timestamp,
135 0,
136 0, 10,
137 0, 10,
138 num_fingers);
139 generator.Dispatch(&fling_start); 119 generator.Dispatch(&fling_start);
140 } 120 }
141 121
142 } // namespace ash 122 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/gestures/overview_gesture_handler.cc ('k') | ash/wm/gestures/shelf_gesture_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698