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

Unified Diff: components/test_runner/event_sender.cc

Issue 1391393002: Fire pointerup/down events for corresponding mouse events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Skipped the failing test. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/event_sender.cc
diff --git a/components/test_runner/event_sender.cc b/components/test_runner/event_sender.cc
index 9560ea3393c47a9f3fd54a3636348736a5bc9da2..53df5bc12e273ac1f1cfcf6bcae20d732f1832ca 100644
--- a/components/test_runner/event_sender.cc
+++ b/components/test_runner/event_sender.cc
@@ -49,6 +49,36 @@ namespace test_runner {
namespace {
+WebMouseEvent::Button GetButtonTypeFromButtonNumber(int button_code) {
+ switch (button_code) {
+ case -1:
+ return WebMouseEvent::ButtonNone;
+ case 0:
+ return WebMouseEvent::ButtonLeft;
+ case 1:
+ return WebMouseEvent::ButtonMiddle;
+ case 2:
+ return WebMouseEvent::ButtonRight;
+ }
+ NOTREACHED();
+ return WebMouseEvent::ButtonNone;
+}
+
+int GetWebMouseEventModifierForButton(WebMouseEvent::Button button) {
+ switch (button) {
+ case WebMouseEvent::ButtonNone:
+ return 0;
+ case WebMouseEvent::ButtonLeft:
+ return WebMouseEvent::LeftButtonDown;
+ case WebMouseEvent::ButtonMiddle:
+ return WebMouseEvent::MiddleButtonDown;
+ case WebMouseEvent::ButtonRight:
+ return WebMouseEvent::RightButtonDown;
+ }
+ NOTREACHED();
+ return 0;
+}
+
void InitMouseEvent(WebInputEvent::Type t,
WebMouseEvent::Button b,
const WebPoint& pos,
@@ -58,7 +88,7 @@ void InitMouseEvent(WebInputEvent::Type t,
WebMouseEvent* e) {
e->type = t;
e->button = b;
- e->modifiers = modifiers;
+ e->modifiers = modifiers | GetWebMouseEventModifierForButton(b);
e->x = pos.x;
e->y = pos.y;
e->globalX = pos.x;
@@ -263,14 +293,6 @@ std::vector<std::string> MakeMenuItemStringsFor(
// WebKit impl and layout test results.
const float kScrollbarPixelsPerTick = 40.0f;
-WebMouseEvent::Button GetButtonTypeFromButtonNumber(int button_code) {
- if (!button_code)
- return WebMouseEvent::ButtonLeft;
- if (button_code == 2)
- return WebMouseEvent::ButtonRight;
- return WebMouseEvent::ButtonMiddle;
-}
-
class MouseDownTask : public WebMethodTask<EventSender> {
public:
MouseDownTask(EventSender* obj, int button_number, int modifiers)
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698