summaryrefslogtreecommitdiffstats
path: root/chrome/test/webdriver/session.cc
diff options
context:
space:
mode:
authorjmikhail@google.com <jmikhail@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-15 23:22:35 +0000
committerjmikhail@google.com <jmikhail@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-15 23:22:35 +0000
commit6f3b4338bc9e1bfc9e184aa5d1e6ccb636e7d1d0 (patch)
treed376eb4ee55d9f6c94db3d97766e2f36b1fe8f6e /chrome/test/webdriver/session.cc
parent027dd44a72b43d91eb6185a9be73cc9ae616b485 (diff)
downloadchromium_src-6f3b4338bc9e1bfc9e184aa5d1e6ccb636e7d1d0.zip
chromium_src-6f3b4338bc9e1bfc9e184aa5d1e6ccb636e7d1d0.tar.gz
chromium_src-6f3b4338bc9e1bfc9e184aa5d1e6ccb636e7d1d0.tar.bz2
Cookie commands for the webdriver protocol
Implements the following URLs for WebDriver: /session/:sessionId/cookie (GET POST DELETE) /session/:sessionId/cookie/:name (DELETE) BUG=none TEST=none Review URL: http://codereview.chromium.org/6330012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75029 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/webdriver/session.cc')
-rw-r--r--chrome/test/webdriver/session.cc58
1 files changed, 58 insertions, 0 deletions
diff --git a/chrome/test/webdriver/session.cc b/chrome/test/webdriver/session.cc
index 665726e..b6ea5fd 100644
--- a/chrome/test/webdriver/session.cc
+++ b/chrome/test/webdriver/session.cc
@@ -23,6 +23,7 @@
#include "chrome/test/test_launcher_utils.h"
#include "chrome/test/webdriver/utility_functions.h"
#include "chrome/test/webdriver/webdriver_key_converter.h"
+#include "googleurl/src/gurl.h"
#include "third_party/webdriver/atoms.h"
namespace webdriver {
@@ -197,6 +198,16 @@ bool Session::GetURL(std::string* url) {
return success;
}
+bool Session::GetURL(GURL* gurl) {
+ bool success = false;
+ RunSessionTask(NewRunnableMethod(
+ automation_.get(),
+ &Automation::GetGURL,
+ gurl,
+ &success));
+ return success;
+}
+
bool Session::GetTabTitle(std::string* tab_title) {
bool success = false;
RunSessionTask(NewRunnableMethod(
@@ -207,6 +218,53 @@ bool Session::GetTabTitle(std::string* tab_title) {
return success;
}
+bool Session::GetCookies(const GURL& url, std::string* cookies) {
+ bool success = false;
+ RunSessionTask(NewRunnableMethod(
+ automation_.get(),
+ &Automation::GetCookies,
+ url,
+ cookies,
+ &success));
+ return success;
+}
+
+bool Session::GetCookieByName(const GURL& url,
+ const std::string& cookie_name,
+ std::string* cookie) {
+ bool success = false;
+ RunSessionTask(NewRunnableMethod(
+ automation_.get(),
+ &Automation::GetCookieByName,
+ url,
+ cookie_name,
+ cookie,
+ &success));
+ return success;
+}
+
+bool Session::DeleteCookie(const GURL& url, const std::string& cookie_name) {
+ bool success = false;
+ RunSessionTask(NewRunnableMethod(
+ automation_.get(),
+ &Automation::DeleteCookie,
+ url,
+ cookie_name,
+ &success));
+ return success;
+}
+
+bool Session::SetCookie(const GURL& url, const std::string& cookie) {
+ bool success = false;
+ RunSessionTask(NewRunnableMethod(
+ automation_.get(),
+ &Automation::SetCookie,
+ url,
+ cookie,
+ &success));
+ return success;
+}
+
void Session::RunSessionTask(Task* task) {
base::WaitableEvent done_event(false, false);
thread_.message_loop_proxy()->PostTask(FROM_HERE, NewRunnableMethod(