summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-04 19:41:05 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-04 19:41:05 +0000
commit95a98141b433f4b1190f58ac4122507f941e3078 (patch)
tree11310e6f6715b0227d3d383a6d580eaeeb46358d /chrome/test
parent340cebd07fb536bfec7de9fd6dea4f0210e9bfce (diff)
downloadchromium_src-95a98141b433f4b1190f58ac4122507f941e3078.zip
chromium_src-95a98141b433f4b1190f58ac4122507f941e3078.tar.gz
chromium_src-95a98141b433f4b1190f58ac4122507f941e3078.tar.bz2
[chromedriver] Implement remaining pure JS commands and screenshot.
BUG=none Review URL: https://chromiumcodereview.appspot.com/12328101 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185946 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/chromedriver/command_executor_impl.cc65
-rw-r--r--chrome/test/chromedriver/element_commands.cc193
-rw-r--r--chrome/test/chromedriver/element_commands.h100
-rw-r--r--chrome/test/chromedriver/stub_web_view.cc4
-rw-r--r--chrome/test/chromedriver/stub_web_view.h1
-rw-r--r--chrome/test/chromedriver/web_view.h3
-rw-r--r--chrome/test/chromedriver/web_view_impl.cc12
-rw-r--r--chrome/test/chromedriver/web_view_impl.h1
-rw-r--r--chrome/test/chromedriver/window_commands.cc148
-rw-r--r--chrome/test/chromedriver/window_commands.h67
10 files changed, 594 insertions, 0 deletions
diff --git a/chrome/test/chromedriver/command_executor_impl.cc b/chrome/test/chromedriver/command_executor_impl.cc
index b706f4a..070c2c7 100644
--- a/chrome/test/chromedriver/command_executor_impl.cc
+++ b/chrome/test/chromedriver/command_executor_impl.cc
@@ -26,6 +26,13 @@
#include "base/mac/scoped_nsautorelease_pool.h"
#endif
+namespace {
+
+const char kLocalStorage[] = "localStorage";
+const char kSessionStorage[] = "sessionStorage";
+
+} // namespace
+
CommandExecutorImpl::CommandExecutorImpl()
: io_thread_("ChromeDriver IO") {}
@@ -56,6 +63,32 @@ void CommandExecutorImpl::Init() {
base::Bind(&ExecuteClearElement);
element_command_map[CommandNames::kSendKeysToElement] =
base::Bind(&ExecuteSendKeysToElement);
+ element_command_map[CommandNames::kSubmitElement] =
+ base::Bind(&ExecuteSubmitElement);
+ element_command_map[CommandNames::kGetElementText] =
+ base::Bind(&ExecuteGetElementText);
+ element_command_map[CommandNames::kGetElementValue] =
+ base::Bind(&ExecuteGetElementValue);
+ element_command_map[CommandNames::kGetElementTagName] =
+ base::Bind(&ExecuteGetElementTagName);
+ element_command_map[CommandNames::kIsElementSelected] =
+ base::Bind(&ExecuteIsElementSelected);
+ element_command_map[CommandNames::kIsElementEnabled] =
+ base::Bind(&ExecuteIsElementEnabled);
+ element_command_map[CommandNames::kIsElementDisplayed] =
+ base::Bind(&ExecuteIsElementDisplayed);
+ element_command_map[CommandNames::kGetElementLocation] =
+ base::Bind(&ExecuteGetElementLocation);
+ element_command_map[CommandNames::kGetElementLocationOnceScrolledIntoView] =
+ base::Bind(&ExecuteGetElementLocationOnceScrolledIntoView);
+ element_command_map[CommandNames::kGetElementSize] =
+ base::Bind(&ExecuteGetElementSize);
+ element_command_map[CommandNames::kGetElementAttribute] =
+ base::Bind(&ExecuteGetElementAttribute);
+ element_command_map[CommandNames::kGetElementValueOfCssProperty] =
+ base::Bind(&ExecuteGetElementValueOfCSSProperty);
+ element_command_map[CommandNames::kElementEquals] =
+ base::Bind(&ExecuteElementEquals);
// Commands which require a window.
typedef std::map<std::string, WindowCommand> WindowCommandMap;
@@ -97,6 +130,38 @@ void CommandExecutorImpl::Init() {
base::Bind(&ExecuteMouseButtonUp);
window_command_map[CommandNames::kMouseDoubleClick] =
base::Bind(&ExecuteMouseDoubleClick);
+ window_command_map[CommandNames::kGetActiveElement] =
+ base::Bind(&ExecuteGetActiveElement);
+ window_command_map[CommandNames::kGetStatus] =
+ base::Bind(&ExecuteGetAppCacheStatus);
+ window_command_map[CommandNames::kIsBrowserOnline] =
+ base::Bind(&ExecuteIsBrowserOnline);
+ window_command_map[CommandNames::kGetLocalStorageItem] =
+ base::Bind(&ExecuteGetStorageItem, kLocalStorage);
+ window_command_map[CommandNames::kGetLocalStorageKeys] =
+ base::Bind(&ExecuteGetStorageKeys, kLocalStorage);
+ window_command_map[CommandNames::kSetLocalStorageItem] =
+ base::Bind(&ExecuteSetStorageItem, kLocalStorage);
+ window_command_map[CommandNames::kRemoveLocalStorageItem] =
+ base::Bind(&ExecuteRemoveStorageItem, kLocalStorage);
+ window_command_map[CommandNames::kClearLocalStorage] =
+ base::Bind(&ExecuteClearStorage, kLocalStorage);
+ window_command_map[CommandNames::kGetLocalStorageSize] =
+ base::Bind(&ExecuteGetStorageSize, kLocalStorage);
+ window_command_map[CommandNames::kGetSessionStorageItem] =
+ base::Bind(&ExecuteGetStorageItem, kSessionStorage);
+ window_command_map[CommandNames::kGetSessionStorageKey] =
+ base::Bind(&ExecuteGetStorageKeys, kSessionStorage);
+ window_command_map[CommandNames::kSetSessionStorageItem] =
+ base::Bind(&ExecuteSetStorageItem, kSessionStorage);
+ window_command_map[CommandNames::kRemoveSessionStorageItem] =
+ base::Bind(&ExecuteRemoveStorageItem, kSessionStorage);
+ window_command_map[CommandNames::kClearSessionStorage] =
+ base::Bind(&ExecuteClearStorage, kSessionStorage);
+ window_command_map[CommandNames::kGetSessionStorageSize] =
+ base::Bind(&ExecuteGetStorageSize, kSessionStorage);
+ window_command_map[CommandNames::kScreenshot] =
+ base::Bind(&ExecuteScreenshot);
// Commands which require a session.
typedef std::map<std::string, SessionCommand> SessionCommandMap;
diff --git a/chrome/test/chromedriver/element_commands.cc b/chrome/test/chromedriver/element_commands.cc
index 1f086e8..df0fb48 100644
--- a/chrome/test/chromedriver/element_commands.cc
+++ b/chrome/test/chromedriver/element_commands.cc
@@ -231,3 +231,196 @@ Status ExecuteSendKeysToElement(
return SendKeysToElement(session, web_view, element_id, keys);
}
}
+
+Status ExecuteSubmitElement(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ webdriver::atoms::asString(webdriver::atoms::SUBMIT),
+ args,
+ value);
+}
+
+Status ExecuteGetElementText(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ webdriver::atoms::asString(webdriver::atoms::GET_TEXT),
+ args,
+ value);
+}
+
+Status ExecuteGetElementValue(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ "function(elem) { return elem['value'] }",
+ args,
+ value);
+}
+
+Status ExecuteGetElementTagName(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ "function(elem) { return elem.tagName.toLowerCase() }",
+ args,
+ value);
+}
+
+Status ExecuteIsElementSelected(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ webdriver::atoms::asString(webdriver::atoms::IS_SELECTED),
+ args,
+ value);
+}
+
+Status ExecuteIsElementEnabled(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ webdriver::atoms::asString(webdriver::atoms::IS_ENABLED),
+ args,
+ value);
+}
+
+Status ExecuteIsElementDisplayed(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ webdriver::atoms::asString(webdriver::atoms::IS_DISPLAYED),
+ args,
+ value);
+}
+
+Status ExecuteGetElementLocation(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ webdriver::atoms::asString(webdriver::atoms::GET_LOCATION),
+ args,
+ value);
+}
+
+Status ExecuteGetElementLocationOnceScrolledIntoView(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ webdriver::atoms::asString(webdriver::atoms::GET_LOCATION_IN_VIEW),
+ args,
+ value);
+}
+
+Status ExecuteGetElementSize(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ webdriver::atoms::asString(webdriver::atoms::GET_SIZE),
+ args,
+ value);
+}
+
+Status ExecuteGetElementAttribute(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ webdriver::atoms::asString(webdriver::atoms::GET_ATTRIBUTE),
+ args,
+ value);
+}
+
+Status ExecuteGetElementValueOfCSSProperty(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ args.Append(CreateElement(element_id));
+ return web_view->CallFunction(
+ session->frame,
+ webdriver::atoms::asString(webdriver::atoms::GET_EFFECTIVE_STYLE),
+ args,
+ value);
+}
+
+Status ExecuteElementEquals(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ std::string other_element_id;
+ if (!params.GetString("other", &other_element_id))
+ return Status(kUnknownError, "'other' must be a string");
+ value->reset(new base::FundamentalValue(element_id == other_element_id));
+ return Status(kOk);
+}
diff --git a/chrome/test/chromedriver/element_commands.h b/chrome/test/chromedriver/element_commands.h
index c3c62c3..78318bc 100644
--- a/chrome/test/chromedriver/element_commands.h
+++ b/chrome/test/chromedriver/element_commands.h
@@ -84,4 +84,104 @@ Status ExecuteSendKeysToElement(
const base::DictionaryValue& params,
scoped_ptr<base::Value>* value);
+// Submit a form element.
+Status ExecuteSubmitElement(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+// Returns the text of a given element.
+Status ExecuteGetElementText(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+// Returns the value of a given element.
+Status ExecuteGetElementValue(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+// Returns the lower case tag name of a given element.
+Status ExecuteGetElementTagName(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteIsElementSelected(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteIsElementEnabled(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteIsElementDisplayed(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+// Returns the location of a given element in page coordinates.
+Status ExecuteGetElementLocation(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+// Returns the location of a given element in client coordinates, after
+// scrolling it into view.
+Status ExecuteGetElementLocationOnceScrolledIntoView(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteGetElementSize(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteGetElementAttribute(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+// Returns the effective style for a given property of the specified element.
+Status ExecuteGetElementValueOfCSSProperty(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+// Returns whether the two given elements are equivalent.
+Status ExecuteElementEquals(
+ Session* session,
+ WebView* web_view,
+ const std::string& element_id,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
#endif // CHROME_TEST_CHROMEDRIVER_ELEMENT_COMMANDS_H_
diff --git a/chrome/test/chromedriver/stub_web_view.cc b/chrome/test/chromedriver/stub_web_view.cc
index 131588b..9718f4a 100644
--- a/chrome/test/chromedriver/stub_web_view.cc
+++ b/chrome/test/chromedriver/stub_web_view.cc
@@ -66,3 +66,7 @@ Status StubWebView::GetMainFrame(std::string* frame_id) {
JavaScriptDialogManager* StubWebView::GetJavaScriptDialogManager() {
return NULL;
}
+
+Status StubWebView::CaptureScreenshot(std::string* screenshot) {
+ return Status(kOk);
+}
diff --git a/chrome/test/chromedriver/stub_web_view.h b/chrome/test/chromedriver/stub_web_view.h
index 7665a2a..4f690a9 100644
--- a/chrome/test/chromedriver/stub_web_view.h
+++ b/chrome/test/chromedriver/stub_web_view.h
@@ -49,6 +49,7 @@ class StubWebView : public WebView {
const std::string& frame_id) OVERRIDE;
virtual Status GetMainFrame(std::string* frame_id) OVERRIDE;
virtual JavaScriptDialogManager* GetJavaScriptDialogManager() OVERRIDE;
+ virtual Status CaptureScreenshot(std::string* screenshot) OVERRIDE;
private:
std::string id_;
diff --git a/chrome/test/chromedriver/web_view.h b/chrome/test/chromedriver/web_view.h
index 8837c90..5c4006b 100644
--- a/chrome/test/chromedriver/web_view.h
+++ b/chrome/test/chromedriver/web_view.h
@@ -77,6 +77,9 @@ class WebView {
// Returns the JavaScriptDialogManager. Never null.
virtual JavaScriptDialogManager* GetJavaScriptDialogManager() = 0;
+
+ // Captures the visible portions of the web view as a base64-encoded PNG.
+ virtual Status CaptureScreenshot(std::string* screenshot) = 0;
};
#endif // CHROME_TEST_CHROMEDRIVER_WEB_VIEW_H_
diff --git a/chrome/test/chromedriver/web_view_impl.cc b/chrome/test/chromedriver/web_view_impl.cc
index e31de46..a439664 100644
--- a/chrome/test/chromedriver/web_view_impl.cc
+++ b/chrome/test/chromedriver/web_view_impl.cc
@@ -237,6 +237,18 @@ JavaScriptDialogManager* WebViewImpl::GetJavaScriptDialogManager() {
return dialog_manager_.get();
}
+Status WebViewImpl::CaptureScreenshot(std::string* screenshot) {
+ base::DictionaryValue params;
+ scoped_ptr<base::DictionaryValue> result;
+ Status status = client_->SendCommandAndGetResult(
+ "Page.captureScreenshot", params, &result);
+ if (status.IsError())
+ return status;
+ if (!result->GetString("data", screenshot))
+ return Status(kUnknownError, "expected string 'data' in response");
+ return Status(kOk);
+}
+
namespace internal {
Status EvaluateScript(DevToolsClient* client,
diff --git a/chrome/test/chromedriver/web_view_impl.h b/chrome/test/chromedriver/web_view_impl.h
index 1a17cc0..176256b 100644
--- a/chrome/test/chromedriver/web_view_impl.h
+++ b/chrome/test/chromedriver/web_view_impl.h
@@ -61,6 +61,7 @@ class WebViewImpl : public WebView {
const std::string& frame_id) OVERRIDE;
virtual Status GetMainFrame(std::string* out_frame) OVERRIDE;
virtual JavaScriptDialogManager* GetJavaScriptDialogManager() OVERRIDE;
+ virtual Status CaptureScreenshot(std::string* screenshot) OVERRIDE;
private:
std::string id_;
diff --git a/chrome/test/chromedriver/window_commands.cc b/chrome/test/chromedriver/window_commands.cc
index f92815a..61843fb 100644
--- a/chrome/test/chromedriver/window_commands.cc
+++ b/chrome/test/chromedriver/window_commands.cc
@@ -341,3 +341,151 @@ Status ExecuteMouseDoubleClick(
session->mouse_position.x, session->mouse_position.y, 2));
return web_view->DispatchMouseEvents(events);
}
+
+Status ExecuteGetActiveElement(
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ base::ListValue args;
+ return web_view->CallFunction(
+ session->frame,
+ "function() { return document.activeElement || document.body }",
+ args,
+ value);
+}
+
+Status ExecuteGetAppCacheStatus(
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ return web_view->EvaluateScript(
+ session->frame,
+ "applicationCache.status",
+ value);
+}
+
+Status ExecuteIsBrowserOnline(
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ return web_view->EvaluateScript(
+ session->frame,
+ "navigator.onLine",
+ value);
+}
+
+Status ExecuteGetStorageItem(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ std::string key;
+ if (!params.GetString("key", &key))
+ return Status(kUnknownError, "'key' must be a string");
+ base::ListValue args;
+ args.Append(new base::StringValue(key));
+ return web_view->CallFunction(
+ session->frame,
+ base::StringPrintf("function(key) { return %s[key]; }", storage),
+ args,
+ value);
+}
+
+Status ExecuteGetStorageKeys(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ const char script[] =
+ "var keys = [];"
+ "for (var key in %s) {"
+ " keys.push(key);"
+ "}"
+ "keys";
+ return web_view->EvaluateScript(
+ session->frame,
+ base::StringPrintf(script, storage),
+ value);
+}
+
+Status ExecuteSetStorageItem(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ std::string key;
+ if (!params.GetString("key", &key))
+ return Status(kUnknownError, "'key' must be a string");
+ std::string storage_value;
+ if (!params.GetString("value", &storage_value))
+ return Status(kUnknownError, "'value' must be a string");
+ base::ListValue args;
+ args.Append(new base::StringValue(key));
+ args.Append(new base::StringValue(storage_value));
+ return web_view->CallFunction(
+ session->frame,
+ base::StringPrintf("function(key, value) { %s[key] = value; }", storage),
+ args,
+ value);
+}
+
+Status ExecuteRemoveStorageItem(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ std::string key;
+ if (!params.GetString("key", &key))
+ return Status(kUnknownError, "'key' must be a string");
+ base::ListValue args;
+ args.Append(new base::StringValue(key));
+ return web_view->CallFunction(
+ session->frame,
+ base::StringPrintf("function(key) { %s.removeItem(key) }", storage),
+ args,
+ value);
+}
+
+Status ExecuteClearStorage(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ return web_view->EvaluateScript(
+ session->frame,
+ base::StringPrintf("%s.clear()", storage),
+ value);
+}
+
+Status ExecuteGetStorageSize(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ return web_view->EvaluateScript(
+ session->frame,
+ base::StringPrintf("%s.length", storage),
+ value);
+}
+
+Status ExecuteScreenshot(
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value) {
+ std::string screenshot;
+ Status status = web_view->CaptureScreenshot(&screenshot);
+ if (status.IsError())
+ return status;
+ value->reset(new base::StringValue(screenshot));
+ return Status(kOk);
+}
diff --git a/chrome/test/chromedriver/window_commands.h b/chrome/test/chromedriver/window_commands.h
index c7fbcd9..a77d2ee 100644
--- a/chrome/test/chromedriver/window_commands.h
+++ b/chrome/test/chromedriver/window_commands.h
@@ -146,4 +146,71 @@ Status ExecuteMouseDoubleClick(
const base::DictionaryValue& params,
scoped_ptr<base::Value>* value);
+Status ExecuteGetActiveElement(
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+// Gets the status of the application cache (window.applicationCache.status).
+Status ExecuteGetAppCacheStatus(
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteIsBrowserOnline(
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteGetStorageItem(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteGetStorageKeys(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteSetStorageItem(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteRemoveStorageItem(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteClearStorage(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteGetStorageSize(
+ const char* storage,
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
+Status ExecuteScreenshot(
+ Session* session,
+ WebView* web_view,
+ const base::DictionaryValue& params,
+ scoped_ptr<base::Value>* value);
+
#endif // CHROME_TEST_CHROMEDRIVER_WINDOW_COMMANDS_H_