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

Side by Side Diff: ash/drag_drop/drag_drop_controller_unittest.cc

Issue 2712963003: mustash: Use ui::chromeos::EventRewriter in mus (Closed)
Patch Set: Fix build issues. Created 3 years, 9 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/autoclick/autoclick_controller.cc ('k') | ash/host/ash_window_tree_host_platform.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/drag_drop/drag_drop_controller.h" 5 #include "ash/drag_drop/drag_drop_controller.h"
6 6
7 #include "ash/common/drag_drop/drag_image_view.h" 7 #include "ash/common/drag_drop/drag_image_view.h"
8 #include "ash/drag_drop/drag_drop_tracker.h" 8 #include "ash/drag_drop/drag_drop_tracker.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 256
257 void DispatchGesture(ui::EventType gesture_type, gfx::Point location) { 257 void DispatchGesture(ui::EventType gesture_type, gfx::Point location) {
258 ui::GestureEventDetails event_details(gesture_type); 258 ui::GestureEventDetails event_details(gesture_type);
259 ui::GestureEvent gesture_event(location.x(), location.y(), 0, 259 ui::GestureEvent gesture_event(location.x(), location.y(), 0,
260 ui::EventTimeForNow(), event_details); 260 ui::EventTimeForNow(), event_details);
261 ui::EventSource* event_source = 261 ui::EventSource* event_source =
262 Shell::GetPrimaryRootWindow()->GetHost()->GetEventSource(); 262 Shell::GetPrimaryRootWindow()->GetHost()->GetEventSource();
263 ui::EventSourceTestApi event_source_test(event_source); 263 ui::EventSourceTestApi event_source_test(event_source);
264 ui::EventDispatchDetails details = 264 ui::EventDispatchDetails details =
265 event_source_test.SendEventToProcessor(&gesture_event); 265 event_source_test.SendEventToSink(&gesture_event);
266 CHECK(!details.dispatcher_destroyed); 266 CHECK(!details.dispatcher_destroyed);
267 } 267 }
268 268
269 } // namespace 269 } // namespace
270 270
271 class DragDropControllerTest : public AshTestBase { 271 class DragDropControllerTest : public AshTestBase {
272 public: 272 public:
273 DragDropControllerTest() : AshTestBase() {} 273 DragDropControllerTest() : AshTestBase() {}
274 ~DragDropControllerTest() override {} 274 ~DragDropControllerTest() override {}
275 275
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 generator.MoveMouseBy(0, 1); 684 generator.MoveMouseBy(0, 1);
685 685
686 // We send a unexpected mouse move event. Note that we cannot use 686 // We send a unexpected mouse move event. Note that we cannot use
687 // EventGenerator since it implicitly turns these into mouse drag events. 687 // EventGenerator since it implicitly turns these into mouse drag events.
688 // The DragDropController should simply ignore these events. 688 // The DragDropController should simply ignore these events.
689 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); 689 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint();
690 ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, 690 ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location,
691 mouse_move_location, ui::EventTimeForNow(), 0, 0); 691 mouse_move_location, ui::EventTimeForNow(), 0, 0);
692 ui::EventDispatchDetails details = Shell::GetPrimaryRootWindow() 692 ui::EventDispatchDetails details = Shell::GetPrimaryRootWindow()
693 ->GetHost() 693 ->GetHost()
694 ->event_processor() 694 ->event_sink()
695 ->OnEventFromSource(&mouse_move); 695 ->OnEventFromSource(&mouse_move);
696 ASSERT_FALSE(details.dispatcher_destroyed); 696 ASSERT_FALSE(details.dispatcher_destroyed);
697 } 697 }
698 698
699 generator.ReleaseLeftButton(); 699 generator.ReleaseLeftButton();
700 700
701 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); 701 EXPECT_TRUE(drag_drop_controller_->drag_start_received_);
702 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), 702 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(),
703 drag_drop_controller_->num_drag_updates_); 703 drag_drop_controller_->num_drag_updates_);
704 EXPECT_TRUE(drag_drop_controller_->drop_received_); 704 EXPECT_TRUE(drag_drop_controller_->drop_received_);
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 drag_drop_controller_->drag_string_); 1100 drag_drop_controller_->drag_string_);
1101 EXPECT_EQ(1, drag_view->num_drag_enters_); 1101 EXPECT_EQ(1, drag_view->num_drag_enters_);
1102 EXPECT_EQ(2, drag_view->num_drag_updates_); 1102 EXPECT_EQ(2, drag_view->num_drag_updates_);
1103 EXPECT_EQ(1, drag_view->num_drops_); 1103 EXPECT_EQ(1, drag_view->num_drops_);
1104 EXPECT_EQ(0, drag_view->num_drag_exits_); 1104 EXPECT_EQ(0, drag_view->num_drag_exits_);
1105 EXPECT_TRUE(drag_view->drag_done_received_); 1105 EXPECT_TRUE(drag_view->drag_done_received_);
1106 } 1106 }
1107 1107
1108 } // namespace test 1108 } // namespace test
1109 } // namespace ash 1109 } // namespace ash
OLDNEW
« no previous file with comments | « ash/autoclick/autoclick_controller.cc ('k') | ash/host/ash_window_tree_host_platform.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698