| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/shell/renderer/test_runner/event_sender.h" | 5 #include "content/shell/renderer/test_runner/event_sender.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "content/public/common/page_zoom.h" | 10 #include "content/public/common/page_zoom.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 return WebMouseEvent::ButtonMiddle; | 226 return WebMouseEvent::ButtonMiddle; |
| 227 } | 227 } |
| 228 | 228 |
| 229 class MouseDownTask : public WebMethodTask<EventSender> { | 229 class MouseDownTask : public WebMethodTask<EventSender> { |
| 230 public: | 230 public: |
| 231 MouseDownTask(EventSender* obj, int button_number, int modifiers) | 231 MouseDownTask(EventSender* obj, int button_number, int modifiers) |
| 232 : WebMethodTask<EventSender>(obj), | 232 : WebMethodTask<EventSender>(obj), |
| 233 button_number_(button_number), | 233 button_number_(button_number), |
| 234 modifiers_(modifiers) {} | 234 modifiers_(modifiers) {} |
| 235 | 235 |
| 236 virtual void runIfValid() OVERRIDE { | 236 virtual void RunIfValid() OVERRIDE { |
| 237 m_object->MouseDown(button_number_, modifiers_); | 237 object_->MouseDown(button_number_, modifiers_); |
| 238 } | 238 } |
| 239 | 239 |
| 240 private: | 240 private: |
| 241 int button_number_; | 241 int button_number_; |
| 242 int modifiers_; | 242 int modifiers_; |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 class MouseUpTask : public WebMethodTask<EventSender> { | 245 class MouseUpTask : public WebMethodTask<EventSender> { |
| 246 public: | 246 public: |
| 247 MouseUpTask(EventSender* obj, int button_number, int modifiers) | 247 MouseUpTask(EventSender* obj, int button_number, int modifiers) |
| 248 : WebMethodTask<EventSender>(obj), | 248 : WebMethodTask<EventSender>(obj), |
| 249 button_number_(button_number), | 249 button_number_(button_number), |
| 250 modifiers_(modifiers) {} | 250 modifiers_(modifiers) {} |
| 251 | 251 |
| 252 virtual void runIfValid() OVERRIDE { | 252 virtual void RunIfValid() OVERRIDE { |
| 253 m_object->MouseUp(button_number_, modifiers_); | 253 object_->MouseUp(button_number_, modifiers_); |
| 254 } | 254 } |
| 255 | 255 |
| 256 private: | 256 private: |
| 257 int button_number_; | 257 int button_number_; |
| 258 int modifiers_; | 258 int modifiers_; |
| 259 }; | 259 }; |
| 260 | 260 |
| 261 class KeyDownTask : public WebMethodTask<EventSender> { | 261 class KeyDownTask : public WebMethodTask<EventSender> { |
| 262 public: | 262 public: |
| 263 KeyDownTask(EventSender* obj, | 263 KeyDownTask(EventSender* obj, |
| 264 const std::string code_str, | 264 const std::string code_str, |
| 265 int modifiers, | 265 int modifiers, |
| 266 KeyLocationCode location) | 266 KeyLocationCode location) |
| 267 : WebMethodTask<EventSender>(obj), | 267 : WebMethodTask<EventSender>(obj), |
| 268 code_str_(code_str), | 268 code_str_(code_str), |
| 269 modifiers_(modifiers), | 269 modifiers_(modifiers), |
| 270 location_(location) {} | 270 location_(location) {} |
| 271 | 271 |
| 272 virtual void runIfValid() OVERRIDE { | 272 virtual void RunIfValid() OVERRIDE { |
| 273 m_object->KeyDown(code_str_, modifiers_, location_); | 273 object_->KeyDown(code_str_, modifiers_, location_); |
| 274 } | 274 } |
| 275 | 275 |
| 276 private: | 276 private: |
| 277 std::string code_str_; | 277 std::string code_str_; |
| 278 int modifiers_; | 278 int modifiers_; |
| 279 KeyLocationCode location_; | 279 KeyLocationCode location_; |
| 280 }; | 280 }; |
| 281 | 281 |
| 282 bool NeedsShiftModifier(int keyCode) { | 282 bool NeedsShiftModifier(int keyCode) { |
| 283 // If code is an uppercase letter, assign a SHIFT key to eventDown.modifier. | 283 // If code is an uppercase letter, assign a SHIFT key to eventDown.modifier. |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 wm_sys_char_ = WM_SYSCHAR; | 1105 wm_sys_char_ = WM_SYSCHAR; |
| 1106 wm_sys_dead_char_ = WM_SYSDEADCHAR; | 1106 wm_sys_dead_char_ = WM_SYSDEADCHAR; |
| 1107 #endif | 1107 #endif |
| 1108 | 1108 |
| 1109 last_mouse_pos_ = WebPoint(0, 0); | 1109 last_mouse_pos_ = WebPoint(0, 0); |
| 1110 last_click_time_sec_ = 0; | 1110 last_click_time_sec_ = 0; |
| 1111 last_click_pos_ = WebPoint(0, 0); | 1111 last_click_pos_ = WebPoint(0, 0); |
| 1112 last_button_type_ = WebMouseEvent::ButtonNone; | 1112 last_button_type_ = WebMouseEvent::ButtonNone; |
| 1113 touch_points_.clear(); | 1113 touch_points_.clear(); |
| 1114 last_context_menu_data_.reset(); | 1114 last_context_menu_data_.reset(); |
| 1115 task_list_.revokeAll(); | 1115 task_list_.RevokeAll(); |
| 1116 current_gesture_location_ = WebPoint(0, 0); | 1116 current_gesture_location_ = WebPoint(0, 0); |
| 1117 mouse_event_queue_.clear(); | 1117 mouse_event_queue_.clear(); |
| 1118 | 1118 |
| 1119 time_offset_ms_ = 0; | 1119 time_offset_ms_ = 0; |
| 1120 click_count_ = 0; | 1120 click_count_ = 0; |
| 1121 | 1121 |
| 1122 touch_modifiers_ = 0; | 1122 touch_modifiers_ = 0; |
| 1123 touch_cancelable_ = true; | 1123 touch_cancelable_ = true; |
| 1124 touch_points_.clear(); | 1124 touch_points_.clear(); |
| 1125 } | 1125 } |
| (...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2291 } | 2291 } |
| 2292 default: | 2292 default: |
| 2293 NOTREACHED(); | 2293 NOTREACHED(); |
| 2294 } | 2294 } |
| 2295 } | 2295 } |
| 2296 | 2296 |
| 2297 replaying_saved_events_ = false; | 2297 replaying_saved_events_ = false; |
| 2298 } | 2298 } |
| 2299 | 2299 |
| 2300 } // namespace content | 2300 } // namespace content |
| OLD | NEW |