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 void RunIfValid() override { object_->MouseDown(button_number_, modifiers_); } |
237 object_->MouseDown(button_number_, modifiers_); | |
238 } | |
239 | 237 |
240 private: | 238 private: |
241 int button_number_; | 239 int button_number_; |
242 int modifiers_; | 240 int modifiers_; |
243 }; | 241 }; |
244 | 242 |
245 class MouseUpTask : public WebMethodTask<EventSender> { | 243 class MouseUpTask : public WebMethodTask<EventSender> { |
246 public: | 244 public: |
247 MouseUpTask(EventSender* obj, int button_number, int modifiers) | 245 MouseUpTask(EventSender* obj, int button_number, int modifiers) |
248 : WebMethodTask<EventSender>(obj), | 246 : WebMethodTask<EventSender>(obj), |
249 button_number_(button_number), | 247 button_number_(button_number), |
250 modifiers_(modifiers) {} | 248 modifiers_(modifiers) {} |
251 | 249 |
252 virtual void RunIfValid() override { | 250 void RunIfValid() override { object_->MouseUp(button_number_, modifiers_); } |
253 object_->MouseUp(button_number_, modifiers_); | |
254 } | |
255 | 251 |
256 private: | 252 private: |
257 int button_number_; | 253 int button_number_; |
258 int modifiers_; | 254 int modifiers_; |
259 }; | 255 }; |
260 | 256 |
261 class KeyDownTask : public WebMethodTask<EventSender> { | 257 class KeyDownTask : public WebMethodTask<EventSender> { |
262 public: | 258 public: |
263 KeyDownTask(EventSender* obj, | 259 KeyDownTask(EventSender* obj, |
264 const std::string code_str, | 260 const std::string code_str, |
265 int modifiers, | 261 int modifiers, |
266 KeyLocationCode location) | 262 KeyLocationCode location) |
267 : WebMethodTask<EventSender>(obj), | 263 : WebMethodTask<EventSender>(obj), |
268 code_str_(code_str), | 264 code_str_(code_str), |
269 modifiers_(modifiers), | 265 modifiers_(modifiers), |
270 location_(location) {} | 266 location_(location) {} |
271 | 267 |
272 virtual void RunIfValid() override { | 268 void RunIfValid() override { |
273 object_->KeyDown(code_str_, modifiers_, location_); | 269 object_->KeyDown(code_str_, modifiers_, location_); |
274 } | 270 } |
275 | 271 |
276 private: | 272 private: |
277 std::string code_str_; | 273 std::string code_str_; |
278 int modifiers_; | 274 int modifiers_; |
279 KeyLocationCode location_; | 275 KeyLocationCode location_; |
280 }; | 276 }; |
281 | 277 |
282 bool NeedsShiftModifier(int keyCode) { | 278 bool NeedsShiftModifier(int keyCode) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 333 |
338 class EventSenderBindings : public gin::Wrappable<EventSenderBindings> { | 334 class EventSenderBindings : public gin::Wrappable<EventSenderBindings> { |
339 public: | 335 public: |
340 static gin::WrapperInfo kWrapperInfo; | 336 static gin::WrapperInfo kWrapperInfo; |
341 | 337 |
342 static void Install(base::WeakPtr<EventSender> sender, | 338 static void Install(base::WeakPtr<EventSender> sender, |
343 blink::WebFrame* frame); | 339 blink::WebFrame* frame); |
344 | 340 |
345 private: | 341 private: |
346 explicit EventSenderBindings(base::WeakPtr<EventSender> sender); | 342 explicit EventSenderBindings(base::WeakPtr<EventSender> sender); |
347 virtual ~EventSenderBindings(); | 343 ~EventSenderBindings() override; |
348 | 344 |
349 // gin::Wrappable: | 345 // gin::Wrappable: |
350 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 346 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
351 v8::Isolate* isolate) override; | 347 v8::Isolate* isolate) override; |
352 | 348 |
353 // Bound methods: | 349 // Bound methods: |
354 void EnableDOMUIEventLogging(); | 350 void EnableDOMUIEventLogging(); |
355 void FireKeyboardEventsToElement(); | 351 void FireKeyboardEventsToElement(); |
356 void ClearKillRing(); | 352 void ClearKillRing(); |
357 std::vector<std::string> ContextClick(); | 353 std::vector<std::string> ContextClick(); |
358 void TextZoomIn(); | 354 void TextZoomIn(); |
359 void TextZoomOut(); | 355 void TextZoomOut(); |
360 void ZoomPageIn(); | 356 void ZoomPageIn(); |
(...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2296 } | 2292 } |
2297 default: | 2293 default: |
2298 NOTREACHED(); | 2294 NOTREACHED(); |
2299 } | 2295 } |
2300 } | 2296 } |
2301 | 2297 |
2302 replaying_saved_events_ = false; | 2298 replaying_saved_events_ = false; |
2303 } | 2299 } |
2304 | 2300 |
2305 } // namespace content | 2301 } // namespace content |
OLD | NEW |