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

Side by Side Diff: chrome/test/chromedriver/window_commands.cc

Issue 22263003: [chromedriver] Implement touch down, up, and move commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromedriver/window_commands.h" 5 #include "chrome/test/chromedriver/window_commands.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 MouseEvent(kPressedMouseEventType, button, 492 MouseEvent(kPressedMouseEventType, button,
493 session->mouse_position.x, session->mouse_position.y, 493 session->mouse_position.x, session->mouse_position.y,
494 session->sticky_modifiers, 2)); 494 session->sticky_modifiers, 2));
495 events.push_back( 495 events.push_back(
496 MouseEvent(kReleasedMouseEventType, button, 496 MouseEvent(kReleasedMouseEventType, button,
497 session->mouse_position.x, session->mouse_position.y, 497 session->mouse_position.x, session->mouse_position.y,
498 session->sticky_modifiers, 2)); 498 session->sticky_modifiers, 2));
499 return web_view->DispatchMouseEvents(events, session->GetCurrentFrameId()); 499 return web_view->DispatchMouseEvents(events, session->GetCurrentFrameId());
500 } 500 }
501 501
502 Status ExecuteTouchDown(
503 Session* session,
504 WebView* web_view,
505 const base::DictionaryValue& params,
506 scoped_ptr<base::Value>* value) {
507 int x, y;
508 if (!params.GetInteger("x", &x))
509 return Status(kUnknownError, "'x' must be an integer");
510 if (!params.GetInteger("y", &y))
511 return Status(kUnknownError, "'y' must be an integer");
512
513 std::list<TouchEvent> events;
514 events.push_back(
515 TouchEvent(kTouchStart, x, y));
516 return web_view->DispatchTouchEvents(events);
517 }
518
519 Status ExecuteTouchUp(
520 Session* session,
521 WebView* web_view,
522 const base::DictionaryValue& params,
523 scoped_ptr<base::Value>* value) {
524 int x, y;
525 if (!params.GetInteger("x", &x))
526 return Status(kUnknownError, "'x' must be an integer");
527 if (!params.GetInteger("y", &y))
528 return Status(kUnknownError, "'y' must be an integer");
529
530 std::list<TouchEvent> events;
531 events.push_back(
532 TouchEvent(kTouchEnd, x, y));
533 return web_view->DispatchTouchEvents(events);
534 }
535
536 Status ExecuteTouchMove(
537 Session* session,
538 WebView* web_view,
539 const base::DictionaryValue& params,
540 scoped_ptr<base::Value>* value) {
541 int x, y;
542 if (!params.GetInteger("x", &x))
543 return Status(kUnknownError, "'x' must be an integer");
544 if (!params.GetInteger("y", &y))
545 return Status(kUnknownError, "'y' must be an integer");
546
547 std::list<TouchEvent> events;
548 events.push_back(
549 TouchEvent(kTouchMove, x, y));
550 return web_view->DispatchTouchEvents(events);
551 }
552
502 Status ExecuteGetActiveElement( 553 Status ExecuteGetActiveElement(
503 Session* session, 554 Session* session,
504 WebView* web_view, 555 WebView* web_view,
505 const base::DictionaryValue& params, 556 const base::DictionaryValue& params,
506 scoped_ptr<base::Value>* value) { 557 scoped_ptr<base::Value>* value) {
507 base::ListValue args; 558 base::ListValue args;
508 return web_view->CallFunction( 559 return web_view->CallFunction(
509 session->GetCurrentFrameId(), 560 session->GetCurrentFrameId(),
510 "function() { return document.activeElement || document.body }", 561 "function() { return document.activeElement || document.body }",
511 args, 562 args,
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 // |accuracy| is not part of the WebDriver spec yet, so if it is not given 806 // |accuracy| is not part of the WebDriver spec yet, so if it is not given
756 // default to 100 meters accuracy. 807 // default to 100 meters accuracy.
757 geoposition.accuracy = 100; 808 geoposition.accuracy = 100;
758 } 809 }
759 810
760 Status status = web_view->OverrideGeolocation(geoposition); 811 Status status = web_view->OverrideGeolocation(geoposition);
761 if (status.IsOk()) 812 if (status.IsOk())
762 session->overridden_geoposition.reset(new Geoposition(geoposition)); 813 session->overridden_geoposition.reset(new Geoposition(geoposition));
763 return status; 814 return status;
764 } 815 }
OLDNEW
« chrome/test/chromedriver/test_expectations ('K') | « chrome/test/chromedriver/window_commands.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698