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

Unified Diff: chrome/test/webdriver/commands/cookie_commands.h

Issue 6330012: Cookie commands for the webdriver protocol (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update Created 9 years, 11 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
Index: chrome/test/webdriver/commands/cookie_commands.h
diff --git a/chrome/test/webdriver/commands/cookie_commands.h b/chrome/test/webdriver/commands/cookie_commands.h
new file mode 100644
index 0000000000000000000000000000000000000000..7640c101f189f61f12704426db600d55b9245270
--- /dev/null
+++ b/chrome/test/webdriver/commands/cookie_commands.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2010 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.
+
+#pragma once
kkania 2011/02/04 17:04:44 put this after the #define CHROME_TEST....
Joe 2011/02/09 06:32:10 If you place it after the ifdef doesn't that defea
+#ifndef CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_
+#define CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_
+
+#include "chrome/test/webdriver/commands/webdriver_command.h"
+
+namespace webdriver {
+
+// Retrieve all cookies visible to the current page. Each cookie will be
+// returned as a JSON object with the following properties:
+// name, value, path, domain, secure, and expiry. See:
+// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/cookie
+class CookieCommand: public WebDriverCommand {
John Grabowski 2011/02/04 02:40:23 Here you have class CookieCommand: later in this
Joe 2011/02/09 06:32:10 I named the classes after the URLS of the JSON web
+ public:
+ CookieCommand(const std::vector<std::string> path_segments,
+ const DictionaryValue* const parameters)
+ : WebDriverCommand(path_segments, parameters) {}
+ virtual ~CookieCommand(){}
+
+ virtual bool Init(Response* const response);
+
+ virtual bool DoesDelete() { return true; }
+ virtual bool DoesGet() { return true; }
+ virtual bool DoesPost() { return true; }
+
+ virtual void ExecuteDelete(Response* const response);
+ virtual void ExecuteGet(Response* const response);
+ virtual void ExecutePost(Response* const response);
+
+ private:
+ GURL current_url_;
kkania 2011/02/04 17:04:44 need to include GURL header in this file since you
Joe 2011/02/09 06:32:10 Done.
+
+ virtual bool RequiresValidTab() { return true; }
+
+ DISALLOW_COPY_AND_ASSIGN(CookieCommand);
+};
+
+// Set a cookie. The cookie should be specified as a JSON object with the
+// following properties: name, value, path, domain, secure, and expiry. See:
+// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/cookie/:name
+class NamedCookieCommand : public WebDriverCommand {
+ public:
+ NamedCookieCommand(const std::vector<std::string> path_segments,
+ const DictionaryValue* const parameters)
+ : WebDriverCommand(path_segments, parameters) {}
+ virtual ~NamedCookieCommand(){}
+
+ virtual bool Init(Response* const response);
+
+ protected:
+ virtual bool DoesDelete() { return true; }
+ virtual bool DoesGet() { return true; }
+
+ virtual void ExecuteDelete(Response* const response);
+ virtual void ExecuteGet(Response* const response);
+
+ private:
+ GURL current_url_;
+ std::string cookie_name_;
kkania 2011/02/04 17:04:44 need to #include <string>
Joe 2011/02/09 06:32:10 Done.
+
+ virtual bool RequiresValidTab() { return true; }
+
+ DISALLOW_COPY_AND_ASSIGN(NamedCookieCommand);
+};
+
+} // namespace webdriver
+
+#endif // CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_
+

Powered by Google App Engine
This is Rietveld 408576698