diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-20 00:10:04 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-20 00:10:04 +0000 |
commit | bcfcd6ae48bf6fdc6ffbad2c55df861408ab51c1 (patch) | |
tree | 0330abe50c40c6e4d368f3f97121c0d92fa5e524 | |
parent | 3114e0ab0e850bef1686456d869d27daf652b120 (diff) | |
download | chromium_src-bcfcd6ae48bf6fdc6ffbad2c55df861408ab51c1.zip chromium_src-bcfcd6ae48bf6fdc6ffbad2c55df861408ab51c1.tar.gz chromium_src-bcfcd6ae48bf6fdc6ffbad2c55df861408ab51c1.tar.bz2 |
Update the ChomeDriver HTML5 storage commands to match the current spec.
Report that the driver supports the webStorage capability.
BUG=chromedriver:15
TEST=none
Review URL: http://codereview.chromium.org/10123018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133092 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/test/webdriver/commands/html5_storage_commands.cc | 80 | ||||
-rw-r--r-- | chrome/test/webdriver/commands/html5_storage_commands.h | 16 | ||||
-rw-r--r-- | chrome/test/webdriver/commands/session_with_id.cc | 4 |
3 files changed, 50 insertions, 50 deletions
diff --git a/chrome/test/webdriver/commands/html5_storage_commands.cc b/chrome/test/webdriver/commands/html5_storage_commands.cc index 26084cb..a16456c 100644 --- a/chrome/test/webdriver/commands/html5_storage_commands.cc +++ b/chrome/test/webdriver/commands/html5_storage_commands.cc @@ -22,6 +22,10 @@ bool LocalStorageCommand::DoesGet() { return true; } +bool LocalStorageCommand::DoesPost() { + return true; +} + bool LocalStorageCommand::DoesDelete() { return true; } @@ -36,6 +40,22 @@ void LocalStorageCommand::ExecuteGet(Response* const response) { response->SetValue(keys); } +void LocalStorageCommand::ExecutePost(Response* const response) { + // "/session/$sessionId/local_storage" + std::string key; + std::string value; + if (!GetStringParameter("key", &key) || + !GetStringParameter("value", &value)) { + response->SetError(new Error( + kBadRequest, "('key', 'value') parameter is missing or invalid")); + return; + } + + Error* error = session_->SetStorageItem(kLocalStorageType, key, value); + if (error) + response->SetError(error); +} + void LocalStorageCommand::ExecuteDelete(Response* const response) { Error* error = session_->ClearStorage(kLocalStorageType); if (error) @@ -53,10 +73,6 @@ bool LocalStorageKeyCommand::DoesGet() { return true; } -bool LocalStorageKeyCommand::DoesPost() { - return true; -} - bool LocalStorageKeyCommand::DoesDelete() { return true; } @@ -73,22 +89,6 @@ void LocalStorageKeyCommand::ExecuteGet(Response* const response) { response->SetValue(new base::StringValue(value)); } -void LocalStorageKeyCommand::ExecutePost(Response* const response) { - // "/session/$sessionId/local_storage/key" - std::string key; - std::string value; - if (!GetStringParameter("key", &key) || - !GetStringParameter("value", &value)) { - response->SetError(new Error( - kBadRequest, "('key', 'value') parameter is missing or invalid")); - return; - } - - Error* error = session_->SetStorageItem(kLocalStorageType, key, value); - if (error) - response->SetError(error); -} - void LocalStorageKeyCommand::ExecuteDelete(Response* const response) { // "/session/$sessionId/local_storage/key/$key" std::string key = GetPathVariable(5); @@ -133,6 +133,10 @@ bool SessionStorageCommand::DoesGet() { return true; } +bool SessionStorageCommand::DoesPost() { + return true; +} + bool SessionStorageCommand::DoesDelete() { return true; } @@ -147,6 +151,22 @@ void SessionStorageCommand::ExecuteGet(Response* const response) { response->SetValue(keys); } +void SessionStorageCommand::ExecutePost(Response* const response) { + // "/session/$sessionId/session_storage" + std::string key; + std::string value; + if (!GetStringParameter("key", &key) || + !GetStringParameter("value", &value)) { + response->SetError(new Error( + kBadRequest, "('key', 'value') parameter is missing or invalid")); + return; + } + + Error* error = session_->SetStorageItem(kSessionStorageType, key, value); + if (error) + response->SetError(error); +} + void SessionStorageCommand::ExecuteDelete(Response* const response) { Error* error = session_->ClearStorage(kSessionStorageType); if (error) @@ -164,10 +184,6 @@ bool SessionStorageKeyCommand::DoesGet() { return true; } -bool SessionStorageKeyCommand::DoesPost() { - return true; -} - bool SessionStorageKeyCommand::DoesDelete() { return true; } @@ -184,22 +200,6 @@ void SessionStorageKeyCommand::ExecuteGet(Response* const response) { response->SetValue(new base::StringValue(value)); } -void SessionStorageKeyCommand::ExecutePost(Response* const response) { - // "/session/$sessionId/session_storage/key" - std::string key; - std::string value; - if (!GetStringParameter("key", &key) || - !GetStringParameter("value", &value)) { - response->SetError(new Error( - kBadRequest, "('key', 'value') parameter is missing or invalid")); - return; - } - - Error* error = session_->SetStorageItem(kSessionStorageType, key, value); - if (error) - response->SetError(error); -} - void SessionStorageKeyCommand::ExecuteDelete(Response* const response) { // "/session/$sessionId/session_storage/key/$key" std::string key = GetPathVariable(5); diff --git a/chrome/test/webdriver/commands/html5_storage_commands.h b/chrome/test/webdriver/commands/html5_storage_commands.h index 68b84ba..d108fa2 100644 --- a/chrome/test/webdriver/commands/html5_storage_commands.h +++ b/chrome/test/webdriver/commands/html5_storage_commands.h @@ -25,11 +25,15 @@ class LocalStorageCommand : public WebDriverCommand { virtual ~LocalStorageCommand(); virtual bool DoesGet() OVERRIDE; + virtual bool DoesPost() OVERRIDE; virtual bool DoesDelete() OVERRIDE; // Returns the list of all keys in the HTML5 localStorage object. virtual void ExecuteGet(Response* const response) OVERRIDE; + // Sets the value of an item in the HTML5 localStorage. + virtual void ExecutePost(Response* const response) OVERRIDE; + // Deletes all items from the localStorage object. virtual void ExecuteDelete(Response* const response) OVERRIDE; @@ -44,15 +48,11 @@ class LocalStorageKeyCommand : public WebDriverCommand { virtual ~LocalStorageKeyCommand(); virtual bool DoesGet() OVERRIDE; - virtual bool DoesPost() OVERRIDE; virtual bool DoesDelete() OVERRIDE; // Returns the value of an item in the HTML5 localStorage. virtual void ExecuteGet(Response* const response) OVERRIDE; - // Sets the value of an item in the HTML5 localStorage. - virtual void ExecutePost(Response* const response) OVERRIDE; - // Deletes an item in the HTML5 localStorage and returns the value. virtual void ExecuteDelete(Response* const response) OVERRIDE; @@ -82,11 +82,15 @@ class SessionStorageCommand : public WebDriverCommand { virtual ~SessionStorageCommand(); virtual bool DoesGet() OVERRIDE; + virtual bool DoesPost() OVERRIDE; virtual bool DoesDelete() OVERRIDE; // Returns the key of all items in the HTML5 sessionStorage object. virtual void ExecuteGet(Response* const response) OVERRIDE; + // Set the value of an item in the HTML5 sessionStorage. + virtual void ExecutePost(Response* const response) OVERRIDE; + // Deletes all items from the sessionStorage object. virtual void ExecuteDelete(Response* const response) OVERRIDE; @@ -101,15 +105,11 @@ class SessionStorageKeyCommand : public WebDriverCommand { virtual ~SessionStorageKeyCommand(); virtual bool DoesGet() OVERRIDE; - virtual bool DoesPost() OVERRIDE; virtual bool DoesDelete() OVERRIDE; // Returns the value of an item in the HTML5 sessionStorage. virtual void ExecuteGet(Response* const response) OVERRIDE; - // Set the value of an item in the HTML5 sessionStorage. - virtual void ExecutePost(Response* const response) OVERRIDE; - // Deletes an item in the HTML5 sessionStorage and returns the value. virtual void ExecuteDelete(Response* const response) OVERRIDE; diff --git a/chrome/test/webdriver/commands/session_with_id.cc b/chrome/test/webdriver/commands/session_with_id.cc index d14236b..dd0f9d0 100644 --- a/chrome/test/webdriver/commands/session_with_id.cc +++ b/chrome/test/webdriver/commands/session_with_id.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -57,7 +57,7 @@ void SessionWithID::ExecuteGet(Response* const response) { temp_value->SetBoolean("applicationCacheEnabled", false); temp_value->SetBoolean("browserConnectionEnabled", false); temp_value->SetBoolean("cssSelectorsEnabled", true); - temp_value->SetBoolean("webStorageEnabled", false); + temp_value->SetBoolean("webStorageEnabled", true); temp_value->SetBoolean("rotatable", false); temp_value->SetBoolean("acceptSslCerts", false); // Even when ChromeDriver does not OS-events, the input simulation produces |