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

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

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: feedback Created 3 years, 8 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
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 "components/exo/touch.h"
6
5 #include "ash/public/cpp/shell_window_ids.h" 7 #include "ash/public/cpp/shell_window_ids.h"
6 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_port.h"
7 #include "ash/wm/window_positioner.h" 10 #include "ash/wm/window_positioner.h"
8 #include "ash/wm/window_positioning_utils.h" 11 #include "ash/wm/window_positioning_utils.h"
9 #include "ash/wm_shell.h"
10 #include "ash/wm_window.h" 12 #include "ash/wm_window.h"
11 #include "components/exo/buffer.h" 13 #include "components/exo/buffer.h"
12 #include "components/exo/shell_surface.h" 14 #include "components/exo/shell_surface.h"
13 #include "components/exo/surface.h" 15 #include "components/exo/surface.h"
14 #include "components/exo/test/exo_test_base.h" 16 #include "components/exo/test/exo_test_base.h"
15 #include "components/exo/test/exo_test_helper.h" 17 #include "components/exo/test/exo_test_helper.h"
16 #include "components/exo/touch.h"
17 #include "components/exo/touch_delegate.h" 18 #include "components/exo/touch_delegate.h"
18 #include "components/exo/touch_stylus_delegate.h" 19 #include "components/exo/touch_stylus_delegate.h"
19 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
20 #include "ui/events/base_event_utils.h" 21 #include "ui/events/base_event_utils.h"
21 #include "ui/events/test/event_generator.h" 22 #include "ui/events/test/event_generator.h"
22 #include "ui/views/widget/widget.h" 23 #include "ui/views/widget/widget.h"
23 24
24 namespace exo { 25 namespace exo {
25 namespace { 26 namespace {
26 27
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 auto window = exo_test_helper()->CreateWindow(10, 10, false); 224 auto window = exo_test_helper()->CreateWindow(10, 10, false);
224 auto modal = exo_test_helper()->CreateWindow(5, 5, true); 225 auto modal = exo_test_helper()->CreateWindow(5, 5, true);
225 226
226 MockTouchDelegate delegate; 227 MockTouchDelegate delegate;
227 std::unique_ptr<Touch> touch(new Touch(&delegate)); 228 std::unique_ptr<Touch> touch(new Touch(&delegate));
228 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow()); 229 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow());
229 230
230 // Make the window modal. 231 // Make the window modal.
231 modal.shell_surface()->SetSystemModal(true); 232 modal.shell_surface()->SetSystemModal(true);
232 233
233 EXPECT_TRUE(ash::WmShell::Get()->IsSystemModalWindowOpen()); 234 EXPECT_TRUE(ash::ShellPort::Get()->IsSystemModalWindowOpen());
234 EXPECT_CALL(delegate, OnTouchShape(testing::_, testing::_, testing::_)) 235 EXPECT_CALL(delegate, OnTouchShape(testing::_, testing::_, testing::_))
235 .Times(testing::AnyNumber()); 236 .Times(testing::AnyNumber());
236 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(window.surface())) 237 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(window.surface()))
237 .WillRepeatedly(testing::Return(true)); 238 .WillRepeatedly(testing::Return(true));
238 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(modal.surface())) 239 EXPECT_CALL(delegate, CanAcceptTouchEventsForSurface(modal.surface()))
239 .WillRepeatedly(testing::Return(true)); 240 .WillRepeatedly(testing::Return(true));
240 241
241 // Check if touch events on modal window are registered. 242 // Check if touch events on modal window are registered.
242 { 243 {
243 testing::InSequence sequence; 244 testing::InSequence sequence;
(...skipping 19 matching lines...) Expand all
263 OnTouchMotion(testing::_, testing::_, gfx::PointF(1, 1))) 264 OnTouchMotion(testing::_, testing::_, gfx::PointF(1, 1)))
264 .Times(0); 265 .Times(0);
265 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_)).Times(0); 266 EXPECT_CALL(delegate, OnTouchUp(testing::_, testing::_)).Times(0);
266 EXPECT_CALL(delegate, OnTouchFrame()).Times(0); 267 EXPECT_CALL(delegate, OnTouchFrame()).Times(0);
267 } 268 }
268 generator.set_current_location(window.origin()); 269 generator.set_current_location(window.origin());
269 generator.PressMoveAndReleaseTouchBy(1, 1); 270 generator.PressMoveAndReleaseTouchBy(1, 1);
270 271
271 // Make the window non-modal. 272 // Make the window non-modal.
272 modal.shell_surface()->SetSystemModal(false); 273 modal.shell_surface()->SetSystemModal(false);
273 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen()); 274 EXPECT_FALSE(ash::ShellPort::Get()->IsSystemModalWindowOpen());
274 275
275 // Check if touch events on non-modal window are registered. 276 // Check if touch events on non-modal window are registered.
276 { 277 {
277 testing::InSequence sequence; 278 testing::InSequence sequence;
278 EXPECT_CALL(delegate, OnTouchDown(window.surface(), testing::_, testing::_, 279 EXPECT_CALL(delegate, OnTouchDown(window.surface(), testing::_, testing::_,
279 gfx::PointF())); 280 gfx::PointF()));
280 EXPECT_CALL(delegate, OnTouchFrame()); 281 EXPECT_CALL(delegate, OnTouchFrame());
281 EXPECT_CALL(delegate, 282 EXPECT_CALL(delegate,
282 OnTouchMotion(testing::_, testing::_, gfx::PointF(1, 1))); 283 OnTouchMotion(testing::_, testing::_, gfx::PointF(1, 1)));
283 EXPECT_CALL(delegate, OnTouchFrame()); 284 EXPECT_CALL(delegate, OnTouchFrame());
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 generator.SetTouchTilt(1.0, 2.0); 394 generator.SetTouchTilt(1.0, 2.0);
394 generator.PressTouch(); 395 generator.PressTouch();
395 generator.ReleaseTouch(); 396 generator.ReleaseTouch();
396 397
397 EXPECT_CALL(delegate, OnTouchDestroying(touch.get())); 398 EXPECT_CALL(delegate, OnTouchDestroying(touch.get()));
398 touch.reset(); 399 touch.reset();
399 } 400 }
400 401
401 } // namespace 402 } // namespace
402 } // namespace exo 403 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698