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

Unified Diff: ui/aura/root_window_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 windows side 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 side-by-side diff with in-line comments
Download patch
Index: ui/aura/root_window_unittest.cc
diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc
index 715240015824a7f2cf1b20755c77fee0b089ba64..df855a15f4c3b81ff6e5167676682a1c7aade5a3 100644
--- a/ui/aura/root_window_unittest.cc
+++ b/ui/aura/root_window_unittest.cc
@@ -112,7 +112,8 @@ TEST_F(RootWindowTest, OnHostMouseEvent) {
// Send a mouse event to window1.
gfx::Point point(101, 201);
ui::MouseEvent event1(
- ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON);
+ ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::EF_LEFT_MOUSE_BUTTON);
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&event1);
// Event was tested for non-client area for the target window.
@@ -134,7 +135,8 @@ TEST_F(RootWindowTest, RepostEvent) {
EXPECT_FALSE(Env::GetInstance()->IsMouseButtonDown());
gfx::Point point(10, 10);
ui::MouseEvent event(
- ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON);
+ ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON,
+ ui::EF_LEFT_MOUSE_BUTTON);
dispatcher()->RepostEvent(event);
RunAllPendingInMessageLoop();
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown());
@@ -153,6 +155,7 @@ TEST_F(RootWindowTest, MouseButtonState) {
ui::ET_MOUSE_PRESSED,
location,
location,
+ ui::EF_LEFT_MOUSE_BUTTON,
ui::EF_LEFT_MOUSE_BUTTON));
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown());
@@ -162,7 +165,8 @@ TEST_F(RootWindowTest, MouseButtonState) {
ui::ET_MOUSE_PRESSED,
location,
location,
- ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON));
+ ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON,
+ ui::EF_RIGHT_MOUSE_BUTTON));
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown());
@@ -171,7 +175,8 @@ TEST_F(RootWindowTest, MouseButtonState) {
ui::ET_MOUSE_RELEASED,
location,
location,
- ui::EF_RIGHT_MOUSE_BUTTON));
+ ui::EF_RIGHT_MOUSE_BUTTON,
+ ui::EF_LEFT_MOUSE_BUTTON));
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown());
@@ -180,7 +185,8 @@ TEST_F(RootWindowTest, MouseButtonState) {
ui::ET_MOUSE_RELEASED,
location,
location,
- ui::EF_SHIFT_DOWN));
+ ui::EF_SHIFT_DOWN,
+ ui::EF_RIGHT_MOUSE_BUTTON));
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
EXPECT_FALSE(Env::GetInstance()->IsMouseButtonDown());
@@ -189,6 +195,7 @@ TEST_F(RootWindowTest, MouseButtonState) {
ui::ET_MOUSE_PRESSED,
location,
location,
+ ui::EF_MIDDLE_MOUSE_BUTTON,
ui::EF_MIDDLE_MOUSE_BUTTON));
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown());
@@ -199,7 +206,7 @@ TEST_F(RootWindowTest, TranslatedEvent) {
gfx::Rect(50, 50, 100, 100), root_window()));
gfx::Point origin(100, 100);
- ui::MouseEvent root(ui::ET_MOUSE_PRESSED, origin, origin, 0);
+ ui::MouseEvent root(ui::ET_MOUSE_PRESSED, origin, origin, 0, 0);
EXPECT_EQ("100,100", root.location().ToString());
EXPECT_EQ("100,100", root.root_location().ToString());
@@ -565,7 +572,7 @@ TEST_F(RootWindowTest, RepostTargetsCaptureWindow) {
window->SetCapture();
const ui::MouseEvent press_event(
ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
dispatcher()->RepostEvent(press_event);
RunAllPendingInMessageLoop(); // Necessitated by RepostEvent().
// Mouse moves/enters may be generated. We only care about a pressed.
@@ -582,7 +589,7 @@ TEST_F(RootWindowTest, MouseMovesHeld) {
&delegate, 1, gfx::Rect(0, 0, 100, 100), root_window()));
ui::MouseEvent mouse_move_event(ui::ET_MOUSE_MOVED, gfx::Point(0, 0),
- gfx::Point(0, 0), 0);
+ gfx::Point(0, 0), 0, 0);
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_move_event);
// Discard MOUSE_ENTER.
@@ -592,7 +599,7 @@ TEST_F(RootWindowTest, MouseMovesHeld) {
// Check that we don't immediately dispatch the MOUSE_DRAGGED event.
ui::MouseEvent mouse_dragged_event(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0),
- gfx::Point(0, 0), 0);
+ gfx::Point(0, 0), 0, 0);
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_dragged_event);
EXPECT_TRUE(filter->events().empty());
@@ -600,7 +607,7 @@ TEST_F(RootWindowTest, MouseMovesHeld) {
// Check that we do dispatch the held MOUSE_DRAGGED event before another type
// of event.
ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0),
- gfx::Point(0, 0), 0);
+ gfx::Point(0, 0), 0, 0);
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_pressed_event);
EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED",
@@ -609,7 +616,7 @@ TEST_F(RootWindowTest, MouseMovesHeld) {
// Check that we coalesce held MOUSE_DRAGGED events.
ui::MouseEvent mouse_dragged_event2(ui::ET_MOUSE_DRAGGED, gfx::Point(1, 1),
- gfx::Point(1, 1), 0);
+ gfx::Point(1, 1), 0, 0);
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_dragged_event);
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
@@ -730,14 +737,14 @@ TEST_F(RootWindowTest, DispatchSyntheticMouseEvents) {
// Dispatch a non-synthetic mouse event when mouse events are enabled.
ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
- gfx::Point(10, 10), 0);
+ gfx::Point(10, 10), 0, 0);
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1);
EXPECT_FALSE(filter->events().empty());
filter->events().clear();
// Dispatch a synthetic mouse event when mouse events are enabled.
ui::MouseEvent mouse2(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
- gfx::Point(10, 10), ui::EF_IS_SYNTHESIZED);
+ gfx::Point(10, 10), ui::EF_IS_SYNTHESIZED, 0);
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse2);
EXPECT_FALSE(filter->events().empty());
filter->events().clear();
@@ -764,7 +771,7 @@ TEST_F(RootWindowTest, DispatchMouseExitWhenCursorHidden) {
// Dispatch a mouse move event into the window.
gfx::Point mouse_location(gfx::Point(15, 25));
ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, mouse_location,
- mouse_location, 0);
+ mouse_location, 0, 0);
EXPECT_TRUE(filter->events().empty());
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1);
EXPECT_FALSE(filter->events().empty());
@@ -1259,7 +1266,7 @@ class DontResetHeldEventWindowDelegate : public test::TestWindowDelegate {
mouse_event_count_++ == 0) {
ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED,
gfx::Point(10, 10), gfx::Point(10, 10),
- ui::EF_SHIFT_DOWN);
+ ui::EF_SHIFT_DOWN, 0);
root_->GetDispatcher()->RepostEvent(mouse_event);
}
}
@@ -1286,10 +1293,10 @@ TEST_F(RootWindowTest, DontResetHeldEvent) {
w1->SetBounds(gfx::Rect(0, 0, 40, 40));
ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED,
gfx::Point(10, 10), gfx::Point(10, 10),
- ui::EF_SHIFT_DOWN);
+ ui::EF_SHIFT_DOWN, 0);
root_window()->GetDispatcher()->RepostEvent(pressed);
ui::MouseEvent pressed2(ui::ET_MOUSE_PRESSED,
- gfx::Point(10, 10), gfx::Point(10, 10), 0);
+ gfx::Point(10, 10), gfx::Point(10, 10), 0, 0);
// Invoke OnHostMouseEvent() to flush event scheduled by way of RepostEvent().
root_window_delegate->OnHostMouseEvent(&pressed2);
// Delegate should have seen reposted event (identified by way of
@@ -1356,7 +1363,7 @@ TEST_F(RootWindowTest, MAYBE_DeleteRootFromHeldMouseEvent) {
w1->SetBounds(gfx::Rect(0, 0, 40, 40));
ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED,
gfx::Point(10, 10), gfx::Point(10, 10),
- ui::EF_SHIFT_DOWN);
+ ui::EF_SHIFT_DOWN, 0);
r2->RepostEvent(pressed);
// RunAllPendingInMessageLoop() to make sure the |pressed| is run.
RunAllPendingInMessageLoop();
« no previous file with comments | « ui/aura/root_window.cc ('k') | ui/aura/test/event_generator.cc » ('j') | ui/events/event.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698