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

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

Issue 101573006: Changes MouseEvent constructor to take changed_button_flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test; needs updated expectations as mouse entered wasnt sent before because of env::mouse_butto… Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ash/display/mouse_cursor_event_filter_unittest.cc ('k') | ash/drag_drop/drag_drop_tracker.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/drag_drop/drag_drop_tracker.h" 7 #include "ash/drag_drop/drag_drop_tracker.h"
8 #include "ash/drag_drop/drag_image_view.h" 8 #include "ash/drag_drop/drag_image_view.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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 // drag_data_ to a fake drag data object that we created. 729 // drag_data_ to a fake drag data object that we created.
730 if (i > 0) 730 if (i > 0)
731 UpdateDragData(&data); 731 UpdateDragData(&data);
732 generator.MoveMouseBy(0, 1); 732 generator.MoveMouseBy(0, 1);
733 733
734 // We send a unexpected mouse move event. Note that we cannot use 734 // We send a unexpected mouse move event. Note that we cannot use
735 // EventGenerator since it implicitly turns these into mouse drag events. 735 // EventGenerator since it implicitly turns these into mouse drag events.
736 // The DragDropController should simply ignore these events. 736 // The DragDropController should simply ignore these events.
737 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); 737 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint();
738 ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, 738 ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location,
739 mouse_move_location, 0); 739 mouse_move_location, 0, 0);
740 Shell::GetPrimaryRootWindow()->GetDispatcher()->AsRootWindowHostDelegate()-> 740 Shell::GetPrimaryRootWindow()->GetDispatcher()->AsRootWindowHostDelegate()->
741 OnHostMouseEvent(&mouse_move); 741 OnHostMouseEvent(&mouse_move);
742 } 742 }
743 743
744 generator.ReleaseLeftButton(); 744 generator.ReleaseLeftButton();
745 745
746 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); 746 EXPECT_TRUE(drag_drop_controller_->drag_start_received_);
747 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), 747 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(),
748 drag_drop_controller_->num_drag_updates_); 748 drag_drop_controller_->num_drag_updates_);
749 EXPECT_TRUE(drag_drop_controller_->drop_received_); 749 EXPECT_TRUE(drag_drop_controller_->drop_received_);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); 1015 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
1016 1016
1017 DragImageWindowObserver observer; 1017 DragImageWindowObserver observer;
1018 ASSERT_TRUE(GetDragImageWindow()); 1018 ASSERT_TRUE(GetDragImageWindow());
1019 GetDragImageWindow()->AddObserver(&observer); 1019 GetDragImageWindow()->AddObserver(&observer);
1020 1020
1021 { 1021 {
1022 ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, 1022 ui::MouseEvent e(ui::ET_MOUSE_DRAGGED,
1023 gfx::Point(200, 0), 1023 gfx::Point(200, 0),
1024 gfx::Point(200, 0), 1024 gfx::Point(200, 0),
1025 ui::EF_NONE,
1025 ui::EF_NONE); 1026 ui::EF_NONE);
1026 drag_drop_controller_->DragUpdate(window, e); 1027 drag_drop_controller_->DragUpdate(window, e);
1027 } 1028 }
1028 { 1029 {
1029 ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, 1030 ui::MouseEvent e(ui::ET_MOUSE_DRAGGED,
1030 gfx::Point(600, 0), 1031 gfx::Point(600, 0),
1031 gfx::Point(600, 0), 1032 gfx::Point(600, 0),
1033 ui::EF_NONE,
1032 ui::EF_NONE); 1034 ui::EF_NONE);
1033 drag_drop_controller_->DragUpdate(window, e); 1035 drag_drop_controller_->DragUpdate(window, e);
1034 } 1036 }
1035 1037
1036 drag_drop_controller_->DragCancel(); 1038 drag_drop_controller_->DragCancel();
1037 CompleteCancelAnimation(); 1039 CompleteCancelAnimation();
1038 1040
1039 EXPECT_EQ("5,5", observer.window_location_on_destroying().ToString()); 1041 EXPECT_EQ("5,5", observer.window_location_on_destroying().ToString());
1040 } 1042 }
1041 1043
1042 { 1044 {
1043 scoped_ptr<views::Widget> widget(CreateNewWidget()); 1045 scoped_ptr<views::Widget> widget(CreateNewWidget());
1044 aura::Window* window = widget->GetNativeWindow(); 1046 aura::Window* window = widget->GetNativeWindow();
1045 drag_drop_controller_->StartDragAndDrop( 1047 drag_drop_controller_->StartDragAndDrop(
1046 data, 1048 data,
1047 window->GetRootWindow(), 1049 window->GetRootWindow(),
1048 window, 1050 window,
1049 gfx::Point(405, 405), 1051 gfx::Point(405, 405),
1050 ui::DragDropTypes::DRAG_MOVE, 1052 ui::DragDropTypes::DRAG_MOVE,
1051 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); 1053 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
1052 DragImageWindowObserver observer; 1054 DragImageWindowObserver observer;
1053 ASSERT_TRUE(GetDragImageWindow()); 1055 ASSERT_TRUE(GetDragImageWindow());
1054 GetDragImageWindow()->AddObserver(&observer); 1056 GetDragImageWindow()->AddObserver(&observer);
1055 1057
1056 { 1058 {
1057 ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, 1059 ui::MouseEvent e(ui::ET_MOUSE_DRAGGED,
1058 gfx::Point(600, 0), 1060 gfx::Point(600, 0),
1059 gfx::Point(600, 0), 1061 gfx::Point(600, 0),
1062 ui::EF_NONE,
1060 ui::EF_NONE); 1063 ui::EF_NONE);
1061 drag_drop_controller_->DragUpdate(window, e); 1064 drag_drop_controller_->DragUpdate(window, e);
1062 } 1065 }
1063 { 1066 {
1064 ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, 1067 ui::MouseEvent e(ui::ET_MOUSE_DRAGGED,
1065 gfx::Point(200, 0), 1068 gfx::Point(200, 0),
1066 gfx::Point(200, 0), 1069 gfx::Point(200, 0),
1070 ui::EF_NONE,
1067 ui::EF_NONE); 1071 ui::EF_NONE);
1068 drag_drop_controller_->DragUpdate(window, e); 1072 drag_drop_controller_->DragUpdate(window, e);
1069 } 1073 }
1070 1074
1071 drag_drop_controller_->DragCancel(); 1075 drag_drop_controller_->DragCancel();
1072 CompleteCancelAnimation(); 1076 CompleteCancelAnimation();
1073 1077
1074 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); 1078 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString());
1075 } 1079 }
1076 for (aura::Window::Windows::iterator iter = root_windows.begin(); 1080 for (aura::Window::Windows::iterator iter = root_windows.begin();
1077 iter != root_windows.end(); ++iter) { 1081 iter != root_windows.end(); ++iter) {
1078 aura::client::SetDragDropClient(*iter, NULL); 1082 aura::client::SetDragDropClient(*iter, NULL);
1079 } 1083 }
1080 } 1084 }
1081 1085
1082 } // namespace test 1086 } // namespace test
1083 } // namespace aura 1087 } // namespace aura
OLDNEW
« no previous file with comments | « ash/display/mouse_cursor_event_filter_unittest.cc ('k') | ash/drag_drop/drag_drop_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698