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

Unified Diff: chrome/test/webdriver/automation.cc

Issue 6482014: Implement sendKeys webdriver API in ChromeDriver. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | « chrome/test/webdriver/automation.h ('k') | chrome/test/webdriver/commands/command.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/webdriver/automation.cc
===================================================================
--- chrome/test/webdriver/automation.cc (revision 74647)
+++ chrome/test/webdriver/automation.cc (working copy)
@@ -5,8 +5,10 @@
#include "chrome/test/webdriver/automation.h"
#include "base/command_line.h"
+#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
+#include "base/values.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
@@ -65,6 +67,26 @@
*result = WideToUTF8(wide_result);
}
+void Automation::SendWebKeyEvent(const WebKeyEvent& key_event,
+ bool* success) {
+ scoped_ptr<DictionaryValue> dict(new DictionaryValue);
+ dict->SetString("command", "SendKeyEventToActiveTab");
+ dict->SetInteger("type", key_event.type);
+ dict->SetInteger("nativeKeyCode", key_event.key_code);
+ dict->SetInteger("windowsKeyCode", key_event.key_code);
+ dict->SetString("unmodifiedText", key_event.unmodified_text);
+ dict->SetString("text", key_event.modified_text);
+ dict->SetInteger("modifiers", key_event.modifiers);
+ dict->SetBoolean("isSystemKey", false);
+ std::string request;
+ base::JSONWriter::Write(dict.get(), false, &request);
+ std::string reply;
+ *success = browser_->SendJSONRequest(request, &reply);
+ if (!*success) {
+ LOG(ERROR) << "Could not send web key event. Reply: " << reply;
+ }
+}
+
void Automation::NavigateToURL(const std::string& url,
bool* success) {
*success = tab_->NavigateToURL(GURL(url));
« no previous file with comments | « chrome/test/webdriver/automation.h ('k') | chrome/test/webdriver/commands/command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698