OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/test/webdriver/commands/mouse_commands.h" | 5 #include "chrome/test/webdriver/commands/mouse_commands.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/common/automation_constants.h" |
8 #include "chrome/test/webdriver/commands/response.h" | 9 #include "chrome/test/webdriver/commands/response.h" |
9 #include "chrome/test/webdriver/error_codes.h" | 10 #include "chrome/test/webdriver/error_codes.h" |
10 #include "chrome/test/webdriver/session.h" | 11 #include "chrome/test/webdriver/session.h" |
11 #include "chrome/test/webdriver/web_element_id.h" | 12 #include "chrome/test/webdriver/web_element_id.h" |
12 #include "ui/base/events.h" | |
13 #include "ui/gfx/point.h" | 13 #include "ui/gfx/point.h" |
14 | 14 |
15 namespace webdriver { | 15 namespace webdriver { |
16 | 16 |
17 MouseCommand::~MouseCommand() {} | 17 MouseCommand::~MouseCommand() {} |
18 | 18 |
19 bool MouseCommand::DoesPost() { | 19 bool MouseCommand::DoesPost() { |
20 return true; | 20 return true; |
21 } | 21 } |
22 | 22 |
(...skipping 13 matching lines...) Expand all Loading... |
36 kInternalServerError); | 36 kInternalServerError); |
37 return; | 37 return; |
38 } | 38 } |
39 | 39 |
40 x += width / 2; | 40 x += width / 2; |
41 y += height / 2; | 41 y += height / 2; |
42 | 42 |
43 switch (cmd_) { | 43 switch (cmd_) { |
44 case kClick: | 44 case kClick: |
45 VLOG(1) << "Mouse click at: (" << x << ", " << y << ")" << std::endl; | 45 VLOG(1) << "Mouse click at: (" << x << ", " << y << ")" << std::endl; |
46 session_->MouseClick(gfx::Point(x, y), ui::EF_LEFT_BUTTON_DOWN); | 46 session_->MouseClick(gfx::Point(x, y), automation::kLeftButton); |
47 break; | 47 break; |
48 | 48 |
49 case kHover: | 49 case kHover: |
50 VLOG(1) << "Mouse hover at: (" << x << ", " << y << ")" << std::endl; | 50 VLOG(1) << "Mouse hover at: (" << x << ", " << y << ")" << std::endl; |
51 session_->MouseMove(gfx::Point(x, y)); | 51 session_->MouseMove(gfx::Point(x, y)); |
52 break; | 52 break; |
53 | 53 |
54 case kDrag: { | 54 case kDrag: { |
55 const int x2 = x + drag_x_; | 55 const int x2 = x + drag_x_; |
56 const int y2 = y + drag_y_; | 56 const int y2 = y + drag_y_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 ClickCommand::~ClickCommand() {} | 102 ClickCommand::~ClickCommand() {} |
103 | 103 |
104 HoverCommand::HoverCommand(const std::vector<std::string>& path_segments, | 104 HoverCommand::HoverCommand(const std::vector<std::string>& path_segments, |
105 const DictionaryValue* const parameters) | 105 const DictionaryValue* const parameters) |
106 : MouseCommand(path_segments, parameters, kHover) {} | 106 : MouseCommand(path_segments, parameters, kHover) {} |
107 | 107 |
108 HoverCommand::~HoverCommand() {} | 108 HoverCommand::~HoverCommand() {} |
109 | 109 |
110 } // namespace webdriver | 110 } // namespace webdriver |
111 | |
OLD | NEW |