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

Side by Side Diff: components/exo/touch_unittest.cc

Issue 2560633002: exo: Implement v6 of touch protocol including shape and frame event (Closed)
Patch Set: Fixed pen pointer mode conflict after rebase Created 4 years 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 | « components/exo/touch_delegate.h ('k') | components/exo/wayland/server.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/aura/wm_window_aura.h" 5 #include "ash/aura/wm_window_aura.h"
6 #include "ash/common/wm/window_positioner.h" 6 #include "ash/common/wm/window_positioner.h"
7 #include "ash/common/wm/window_positioning_utils.h" 7 #include "ash/common/wm/window_positioning_utils.h"
8 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
9 #include "ash/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 18 matching lines...) Expand all
29 public: 29 public:
30 MockTouchDelegate() {} 30 MockTouchDelegate() {}
31 31
32 // Overridden from TouchDelegate: 32 // Overridden from TouchDelegate:
33 MOCK_METHOD1(OnTouchDestroying, void(Touch*)); 33 MOCK_METHOD1(OnTouchDestroying, void(Touch*));
34 MOCK_CONST_METHOD1(CanAcceptTouchEventsForSurface, bool(Surface*)); 34 MOCK_CONST_METHOD1(CanAcceptTouchEventsForSurface, bool(Surface*));
35 MOCK_METHOD4(OnTouchDown, 35 MOCK_METHOD4(OnTouchDown,
36 void(Surface*, base::TimeTicks, int, const gfx::Point&)); 36 void(Surface*, base::TimeTicks, int, const gfx::Point&));
37 MOCK_METHOD2(OnTouchUp, void(base::TimeTicks, int)); 37 MOCK_METHOD2(OnTouchUp, void(base::TimeTicks, int));
38 MOCK_METHOD3(OnTouchMotion, void(base::TimeTicks, int, const gfx::Point&)); 38 MOCK_METHOD3(OnTouchMotion, void(base::TimeTicks, int, const gfx::Point&));
39 MOCK_METHOD3(OnTouchShape, void(int, float, float));
40 MOCK_METHOD0(OnTouchFrame, void());
39 MOCK_METHOD0(OnTouchCancel, void()); 41 MOCK_METHOD0(OnTouchCancel, void());
40 }; 42 };
41 43
42 TEST_F(TouchTest, OnTouchDown) { 44 TEST_F(TouchTest, OnTouchDown) {
43 ash::WindowPositioner::DisableAutoPositioning(true); 45 ash::WindowPositioner::DisableAutoPositioning(true);
44 46
45 std::unique_ptr<Surface> bottom_surface(new Surface); 47 std::unique_ptr<Surface> bottom_surface(new Surface);
46 std::unique_ptr<ShellSurface> bottom_shell_surface( 48 std::unique_ptr<ShellSurface> bottom_shell_surface(
47 new ShellSurface(bottom_surface.get())); 49 new ShellSurface(bottom_surface.get()));
48 gfx::Size bottom_buffer_size(10, 10); 50 gfx::Size bottom_buffer_size(10, 10);
(...skipping 12 matching lines...) Expand all
61 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(top_buffer_size))); 63 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(top_buffer_size)));
62 top_surface->Attach(top_buffer.get()); 64 top_surface->Attach(top_buffer.get());
63 top_surface->Commit(); 65 top_surface->Commit();
64 ash::wm::CenterWindow(ash::WmWindowAura::Get( 66 ash::wm::CenterWindow(ash::WmWindowAura::Get(
65 top_shell_surface->GetWidget()->GetNativeWindow())); 67 top_shell_surface->GetWidget()->GetNativeWindow()));
66 68
67 MockTouchDelegate delegate; 69 MockTouchDelegate delegate;
68 std::unique_ptr<Touch> touch(new Touch(&delegate)); 70 std::unique_ptr<Touch> touch(new Touch(&delegate));
69 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow()); 71 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow());
70 72
73 EXPECT_CALL(delegate, OnTouchShape(testing::_, testing::_, testing::_))
74 .Times(testing::AnyNumber());
71 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(top_surface.get())) 75 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(top_surface.get()))
72 .WillRepeatedly(testing::Return(true)); 76 .WillRepeatedly(testing::Return(true));
73 EXPECT_CALL(delegate, 77 EXPECT_CALL(delegate,
74 OnTouchDown(top_surface.get(), testing::_, 1, gfx::Point())); 78 OnTouchDown(top_surface.get(), testing::_, 1, gfx::Point()));
79 EXPECT_CALL(delegate, OnTouchFrame());
75 generator.set_current_location( 80 generator.set_current_location(
76 top_surface->window()->GetBoundsInScreen().origin()); 81 top_surface->window()->GetBoundsInScreen().origin());
77 generator.PressTouchId(1); 82 generator.PressTouchId(1);
78 83
79 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(bottom_surface.get())) 84 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(bottom_surface.get()))
80 .WillRepeatedly(testing::Return(true)); 85 .WillRepeatedly(testing::Return(true));
86
81 // Second touch point should be relative to the focus surface. 87 // Second touch point should be relative to the focus surface.
82 EXPECT_CALL(delegate, OnTouchDown(top_surface.get(), testing::_, 2, 88 EXPECT_CALL(delegate, OnTouchDown(top_surface.get(), testing::_, 2,
83 gfx::Point(-1, -1))); 89 gfx::Point(-1, -1)));
90 EXPECT_CALL(delegate, OnTouchFrame());
91
84 generator.set_current_location( 92 generator.set_current_location(
85 bottom_surface->window()->GetBoundsInScreen().origin()); 93 bottom_surface->window()->GetBoundsInScreen().origin());
86 generator.PressTouchId(2); 94 generator.PressTouchId(2);
87 95
88 EXPECT_CALL(delegate, OnTouchDestroying(touch.get())); 96 EXPECT_CALL(delegate, OnTouchDestroying(touch.get()));
89 touch.reset(); 97 touch.reset();
90 } 98 }
91 99
92 TEST_F(TouchTest, OnTouchUp) { 100 TEST_F(TouchTest, OnTouchUp) {
93 std::unique_ptr<Surface> surface(new Surface); 101 std::unique_ptr<Surface> surface(new Surface);
94 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 102 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
95 gfx::Size buffer_size(10, 10); 103 gfx::Size buffer_size(10, 10);
96 std::unique_ptr<Buffer> buffer( 104 std::unique_ptr<Buffer> buffer(
97 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 105 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
98 surface->Attach(buffer.get()); 106 surface->Attach(buffer.get());
99 surface->Commit(); 107 surface->Commit();
100 108
101 MockTouchDelegate delegate; 109 MockTouchDelegate delegate;
102 std::unique_ptr<Touch> touch(new Touch(&delegate)); 110 std::unique_ptr<Touch> touch(new Touch(&delegate));
103 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow()); 111 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow());
104 112
113 EXPECT_CALL(delegate, OnTouchShape(testing::_, testing::_, testing::_))
114 .Times(testing::AnyNumber());
105 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface.get())) 115 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface.get()))
106 .WillRepeatedly(testing::Return(true)); 116 .WillRepeatedly(testing::Return(true));
107 EXPECT_CALL(delegate, 117 EXPECT_CALL(delegate,
108 OnTouchDown(surface.get(), testing::_, testing::_, gfx::Point())) 118 OnTouchDown(surface.get(), testing::_, testing::_, gfx::Point()))
109 .Times(2); 119 .Times(2);
120 EXPECT_CALL(delegate, OnTouchFrame()).Times(2);
110 generator.set_current_location( 121 generator.set_current_location(
111 surface->window()->GetBoundsInScreen().origin()); 122 surface->window()->GetBoundsInScreen().origin());
112 generator.PressTouchId(1); 123 generator.PressTouchId(1);
113 generator.PressTouchId(2); 124 generator.PressTouchId(2);
114 125
115 EXPECT_CALL(delegate, OnTouchUp(testing::_, 1)); 126 EXPECT_CALL(delegate, OnTouchUp(testing::_, 1));
127 EXPECT_CALL(delegate, OnTouchFrame());
116 generator.ReleaseTouchId(1); 128 generator.ReleaseTouchId(1);
117 EXPECT_CALL(delegate, OnTouchUp(testing::_, 2)); 129 EXPECT_CALL(delegate, OnTouchUp(testing::_, 2));
130 EXPECT_CALL(delegate, OnTouchFrame());
118 generator.ReleaseTouchId(2); 131 generator.ReleaseTouchId(2);
119 132
120 EXPECT_CALL(delegate, OnTouchDestroying(touch.get())); 133 EXPECT_CALL(delegate, OnTouchDestroying(touch.get()));
121 touch.reset(); 134 touch.reset();
122 } 135 }
123 136
124 TEST_F(TouchTest, OnTouchMotion) { 137 TEST_F(TouchTest, OnTouchMotion) {
125 std::unique_ptr<Surface> surface(new Surface); 138 std::unique_ptr<Surface> surface(new Surface);
126 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 139 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
127 gfx::Size buffer_size(10, 10); 140 gfx::Size buffer_size(10, 10);
128 std::unique_ptr<Buffer> buffer( 141 std::unique_ptr<Buffer> buffer(
129 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 142 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
130 surface->Attach(buffer.get()); 143 surface->Attach(buffer.get());
131 surface->Commit(); 144 surface->Commit();
132 145
133 MockTouchDelegate delegate; 146 MockTouchDelegate delegate;
134 std::unique_ptr<Touch> touch(new Touch(&delegate)); 147 std::unique_ptr<Touch> touch(new Touch(&delegate));
135 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow()); 148 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow());
136 149
150 EXPECT_CALL(delegate, OnTouchShape(testing::_, testing::_, testing::_))
151 .Times(testing::AnyNumber());
137 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface.get())) 152 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface.get()))
138 .WillRepeatedly(testing::Return(true)); 153 .WillRepeatedly(testing::Return(true));
139 EXPECT_CALL(delegate, 154 EXPECT_CALL(delegate,
140 OnTouchDown(surface.get(), testing::_, testing::_, gfx::Point())); 155 OnTouchDown(surface.get(), testing::_, testing::_, gfx::Point()));
141 EXPECT_CALL(delegate, 156 EXPECT_CALL(delegate,
142 OnTouchMotion(testing::_, testing::_, gfx::Point(5, 5))); 157 OnTouchMotion(testing::_, testing::_, gfx::Point(5, 5)));
143 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_)); 158 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_));
159 EXPECT_CALL(delegate, OnTouchFrame()).Times(3);
144 generator.set_current_location( 160 generator.set_current_location(
145 surface->window()->GetBoundsInScreen().origin()); 161 surface->window()->GetBoundsInScreen().origin());
146 generator.PressMoveAndReleaseTouchBy(5, 5); 162 generator.PressMoveAndReleaseTouchBy(5, 5);
147 163
148 // Check if touch point motion outside focus surface is reported properly to 164 // Check if touch point motion outside focus surface is reported properly to
149 // the focus surface. 165 // the focus surface.
150 EXPECT_CALL(delegate, 166 EXPECT_CALL(delegate,
151 OnTouchDown(surface.get(), testing::_, testing::_, gfx::Point())); 167 OnTouchDown(surface.get(), testing::_, testing::_, gfx::Point()));
152 EXPECT_CALL(delegate, 168 EXPECT_CALL(delegate,
153 OnTouchMotion(testing::_, testing::_, gfx::Point(100, 100))); 169 OnTouchMotion(testing::_, testing::_, gfx::Point(100, 100)));
154 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_)); 170 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_));
171 EXPECT_CALL(delegate, OnTouchFrame()).Times(3);
155 generator.set_current_location( 172 generator.set_current_location(
156 surface->window()->GetBoundsInScreen().origin()); 173 surface->window()->GetBoundsInScreen().origin());
157 generator.PressMoveAndReleaseTouchBy(100, 100); 174 generator.PressMoveAndReleaseTouchBy(100, 100);
158 175
159 EXPECT_CALL(delegate, OnTouchDestroying(touch.get())); 176 EXPECT_CALL(delegate, OnTouchDestroying(touch.get()));
160 touch.reset(); 177 touch.reset();
161 } 178 }
162 179
180 TEST_F(TouchTest, OnTouchShape) {
181 std::unique_ptr<Surface> surface(new Surface);
182 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
183 gfx::Size buffer_size(10, 10);
184 std::unique_ptr<Buffer> buffer(
185 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
186 surface->Attach(buffer.get());
187 surface->Commit();
188
189 MockTouchDelegate delegate;
190 std::unique_ptr<Touch> touch(new Touch(&delegate));
191 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow());
192
193 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface.get()))
194 .WillRepeatedly(testing::Return(true));
195 {
196 testing::InSequence sequence;
197 EXPECT_CALL(delegate, OnTouchDown(surface.get(), testing::_, testing::_,
198 gfx::Point()));
199 EXPECT_CALL(delegate, OnTouchShape(testing::_, 1, 1));
200 EXPECT_CALL(delegate, OnTouchFrame());
201 EXPECT_CALL(delegate,
202 OnTouchMotion(testing::_, testing::_, gfx::Point(5, 5)));
203 EXPECT_CALL(delegate, OnTouchShape(testing::_, 1, 1));
204 EXPECT_CALL(delegate, OnTouchFrame());
205 EXPECT_CALL(delegate,
206 OnTouchMotion(testing::_, testing::_, gfx::Point(10, 10)));
207 EXPECT_CALL(delegate, OnTouchShape(testing::_, 20, 10));
208 EXPECT_CALL(delegate, OnTouchFrame());
209 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_));
210 EXPECT_CALL(delegate, OnTouchFrame());
211 }
212 generator.set_current_location(
213 surface->window()->GetBoundsInScreen().origin());
214 generator.PressTouch();
215 generator.MoveTouchBy(5, 5);
216 generator.SetTouchRadius(20, 10);
217 generator.MoveTouchBy(5, 5);
218 generator.ReleaseTouch();
219 EXPECT_CALL(delegate, OnTouchDestroying(touch.get()));
220 touch.reset();
221 }
222
163 TEST_F(TouchTest, OnTouchCancel) { 223 TEST_F(TouchTest, OnTouchCancel) {
164 std::unique_ptr<Surface> surface(new Surface); 224 std::unique_ptr<Surface> surface(new Surface);
165 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 225 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
166 gfx::Size buffer_size(10, 10); 226 gfx::Size buffer_size(10, 10);
167 std::unique_ptr<Buffer> buffer( 227 std::unique_ptr<Buffer> buffer(
168 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 228 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
169 surface->Attach(buffer.get()); 229 surface->Attach(buffer.get());
170 surface->Commit(); 230 surface->Commit();
171 231
172 MockTouchDelegate delegate; 232 MockTouchDelegate delegate;
173 std::unique_ptr<Touch> touch(new Touch(&delegate)); 233 std::unique_ptr<Touch> touch(new Touch(&delegate));
174 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow()); 234 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow());
175 235
236 EXPECT_CALL(delegate, OnTouchShape(testing::_, testing::_, testing::_))
237 .Times(testing::AnyNumber());
176 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface.get())) 238 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface.get()))
177 .WillRepeatedly(testing::Return(true)); 239 .WillRepeatedly(testing::Return(true));
178 EXPECT_CALL(delegate, 240 EXPECT_CALL(delegate,
179 OnTouchDown(surface.get(), testing::_, testing::_, gfx::Point())) 241 OnTouchDown(surface.get(), testing::_, testing::_, gfx::Point()))
180 .Times(2); 242 .Times(2);
243 EXPECT_CALL(delegate, OnTouchFrame()).Times(2);
181 generator.set_current_location( 244 generator.set_current_location(
182 surface->window()->GetBoundsInScreen().origin()); 245 surface->window()->GetBoundsInScreen().origin());
183 generator.PressTouchId(1); 246 generator.PressTouchId(1);
184 generator.PressTouchId(2); 247 generator.PressTouchId(2);
185 248
186 // One touch point being canceled is enough for OnTouchCancel to be called. 249 // One touch point being canceled is enough for OnTouchCancel to be called.
187 EXPECT_CALL(delegate, OnTouchCancel()); 250 EXPECT_CALL(delegate, OnTouchCancel());
251 EXPECT_CALL(delegate, OnTouchFrame());
188 ui::TouchEvent cancel_event(ui::ET_TOUCH_CANCELLED, gfx::Point(), 1, 252 ui::TouchEvent cancel_event(ui::ET_TOUCH_CANCELLED, gfx::Point(), 1,
189 ui::EventTimeForNow()); 253 ui::EventTimeForNow());
190 generator.Dispatch(&cancel_event); 254 generator.Dispatch(&cancel_event);
191 255
192 EXPECT_CALL(delegate, OnTouchDestroying(touch.get())); 256 EXPECT_CALL(delegate, OnTouchDestroying(touch.get()));
193 touch.reset(); 257 touch.reset();
194 } 258 }
195 259
196 TEST_F(TouchTest, IgnoreTouchEventDuringModal) { 260 TEST_F(TouchTest, IgnoreTouchEventDuringModal) {
197 std::unique_ptr<Surface> surface(new Surface); 261 std::unique_ptr<Surface> surface(new Surface);
(...skipping 17 matching lines...) Expand all
215 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(gfx::Size(5, 5)))); 279 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(gfx::Size(5, 5))));
216 surface2->Attach(buffer2.get()); 280 surface2->Attach(buffer2.get());
217 surface2->Commit(); 281 surface2->Commit();
218 ash::wm::CenterWindow(ash::WmWindowAura::Get(surface2->window())); 282 ash::wm::CenterWindow(ash::WmWindowAura::Get(surface2->window()));
219 gfx::Point location2 = surface2->window()->GetBoundsInScreen().origin(); 283 gfx::Point location2 = surface2->window()->GetBoundsInScreen().origin();
220 284
221 // Make the window modal. 285 // Make the window modal.
222 shell_surface2->SetSystemModal(true); 286 shell_surface2->SetSystemModal(true);
223 EXPECT_TRUE(ash::WmShell::Get()->IsSystemModalWindowOpen()); 287 EXPECT_TRUE(ash::WmShell::Get()->IsSystemModalWindowOpen());
224 288
289 EXPECT_CALL(delegate, OnTouchShape(testing::_, testing::_, testing::_))
290 .Times(testing::AnyNumber());
225 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface.get())) 291 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface.get()))
226 .WillRepeatedly(testing::Return(true)); 292 .WillRepeatedly(testing::Return(true));
227 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface2.get())) 293 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(surface2.get()))
228 .WillRepeatedly(testing::Return(true)); 294 .WillRepeatedly(testing::Return(true));
229 295
230 // Check if touch events on modal window are registered. 296 // Check if touch events on modal window are registered.
231 { 297 {
232 testing::InSequence sequence; 298 testing::InSequence sequence;
233 EXPECT_CALL(delegate, OnTouchDown(surface2.get(), testing::_, testing::_, 299 EXPECT_CALL(delegate, OnTouchDown(surface2.get(), testing::_, testing::_,
234 gfx::Point())); 300 gfx::Point()));
301 EXPECT_CALL(delegate, OnTouchFrame());
235 EXPECT_CALL(delegate, 302 EXPECT_CALL(delegate,
236 OnTouchMotion(testing::_, testing::_, gfx::Point(1, 1))); 303 OnTouchMotion(testing::_, testing::_, gfx::Point(1, 1)));
304 EXPECT_CALL(delegate, OnTouchFrame());
237 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_)); 305 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_));
306 EXPECT_CALL(delegate, OnTouchFrame());
238 } 307 }
239 generator.set_current_location(location2); 308 generator.set_current_location(location2);
240 generator.PressMoveAndReleaseTouchBy(1, 1); 309 generator.PressMoveAndReleaseTouchBy(1, 1);
241 310
242 // Check if touch events on non-modal window are ignored. 311 // Check if touch events on non-modal window are ignored.
243 { 312 {
244 testing::InSequence sequence; 313 testing::InSequence sequence;
245 EXPECT_CALL(delegate, OnTouchDown(surface.get(), testing::_, testing::_, 314 EXPECT_CALL(delegate, OnTouchDown(surface.get(), testing::_, testing::_,
246 gfx::Point())) 315 gfx::Point()))
247 .Times(0); 316 .Times(0);
248 EXPECT_CALL(delegate, 317 EXPECT_CALL(delegate,
249 OnTouchMotion(testing::_, testing::_, gfx::Point(1, 1))) 318 OnTouchMotion(testing::_, testing::_, gfx::Point(1, 1)))
250 .Times(0); 319 .Times(0);
251 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_)).Times(0); 320 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_)).Times(0);
321 EXPECT_CALL(delegate, OnTouchFrame()).Times(0);
252 } 322 }
253 generator.set_current_location(location); 323 generator.set_current_location(location);
254 generator.PressMoveAndReleaseTouchBy(1, 1); 324 generator.PressMoveAndReleaseTouchBy(1, 1);
255 325
256 // Make the window non-modal. 326 // Make the window non-modal.
257 shell_surface2->SetSystemModal(false); 327 shell_surface2->SetSystemModal(false);
258 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen()); 328 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen());
259 329
260 // Check if touch events on non-modal window are registered. 330 // Check if touch events on non-modal window are registered.
261 { 331 {
262 testing::InSequence sequence; 332 testing::InSequence sequence;
263 EXPECT_CALL(delegate, OnTouchDown(surface.get(), testing::_, testing::_, 333 EXPECT_CALL(delegate, OnTouchDown(surface.get(), testing::_, testing::_,
264 gfx::Point())); 334 gfx::Point()));
335 EXPECT_CALL(delegate, OnTouchFrame());
265 EXPECT_CALL(delegate, 336 EXPECT_CALL(delegate,
266 OnTouchMotion(testing::_, testing::_, gfx::Point(1, 1))); 337 OnTouchMotion(testing::_, testing::_, gfx::Point(1, 1)));
338 EXPECT_CALL(delegate, OnTouchFrame());
267 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_)); 339 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_));
340 EXPECT_CALL(delegate, OnTouchFrame());
268 } 341 }
269 generator.set_current_location(location); 342 generator.set_current_location(location);
270 generator.PressMoveAndReleaseTouchBy(1, 1); 343 generator.PressMoveAndReleaseTouchBy(1, 1);
271 344
272 EXPECT_CALL(delegate, OnTouchDestroying(touch.get())); 345 EXPECT_CALL(delegate, OnTouchDestroying(touch.get()));
273 touch.reset(); 346 touch.reset();
274 } 347 }
275 348
276 } // namespace 349 } // namespace
277 } // namespace exo 350 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/touch_delegate.h ('k') | components/exo/wayland/server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698