| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_ |
| 6 #define CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_ | 6 #define CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "chrome/test/webdriver/commands/webdriver_command.h" | 12 #include "chrome/test/webdriver/commands/webdriver_command.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 | 14 |
| 15 class DictionaryValue; | 15 class DictionaryValue; |
| 16 | 16 |
| 17 namespace webdriver { | 17 namespace webdriver { |
| 18 | 18 |
| 19 class Response; | 19 class Response; |
| 20 | 20 |
| 21 // Retrieve all cookies visible to the current page. Each cookie will be | 21 // Retrieve all cookies visible to the current page. Each cookie will be |
| 22 // returned as a JSON object with the following properties: | 22 // returned as a JSON object with the following properties: |
| 23 // name, value, path, domain, secure, and expiry. See: | 23 // name, value, path, domain, secure, and expiry. See: |
| 24 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/c
ookie | 24 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/c
ookie |
| 25 class CookieCommand : public WebDriverCommand { | 25 class CookieCommand : public WebDriverCommand { |
| 26 public: | 26 public: |
| 27 CookieCommand(const std::vector<std::string>& path_segments, | 27 CookieCommand(const std::vector<std::string>& path_segments, |
| 28 const DictionaryValue* const parameters) | 28 const DictionaryValue* const parameters); |
| 29 : WebDriverCommand(path_segments, parameters) {} | 29 virtual ~CookieCommand(); |
| 30 virtual ~CookieCommand() {} | |
| 31 | 30 |
| 32 virtual bool Init(Response* const response); | 31 virtual bool Init(Response* const response); |
| 33 | 32 |
| 34 virtual bool DoesDelete() { return true; } | 33 virtual bool DoesDelete(); |
| 35 virtual bool DoesGet() { return true; } | 34 virtual bool DoesGet(); |
| 36 virtual bool DoesPost() { return true; } | 35 virtual bool DoesPost(); |
| 37 | 36 |
| 38 virtual void ExecuteDelete(Response* const response); | 37 virtual void ExecuteDelete(Response* const response); |
| 39 virtual void ExecuteGet(Response* const response); | 38 virtual void ExecuteGet(Response* const response); |
| 40 virtual void ExecutePost(Response* const response); | 39 virtual void ExecutePost(Response* const response); |
| 41 | 40 |
| 42 private: | 41 private: |
| 43 GURL current_url_; | 42 GURL current_url_; |
| 44 | 43 |
| 45 DISALLOW_COPY_AND_ASSIGN(CookieCommand); | 44 DISALLOW_COPY_AND_ASSIGN(CookieCommand); |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 // Set a cookie. The cookie should be specified as a JSON object with the | 47 // Set a cookie. The cookie should be specified as a JSON object with the |
| 49 // following properties: name, value, path, domain, secure, and expiry. See: | 48 // following properties: name, value, path, domain, secure, and expiry. See: |
| 50 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/c
ookie/:name | 49 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/c
ookie/:name |
| 51 class NamedCookieCommand : public WebDriverCommand { | 50 class NamedCookieCommand : public WebDriverCommand { |
| 52 public: | 51 public: |
| 53 NamedCookieCommand(const std::vector<std::string>& path_segments, | 52 NamedCookieCommand(const std::vector<std::string>& path_segments, |
| 54 const DictionaryValue* const parameters) | 53 const DictionaryValue* const parameters); |
| 55 : WebDriverCommand(path_segments, parameters) {} | 54 virtual ~NamedCookieCommand(); |
| 56 virtual ~NamedCookieCommand() {} | |
| 57 | 55 |
| 58 virtual bool Init(Response* const response); | 56 virtual bool Init(Response* const response); |
| 59 | 57 |
| 60 protected: | 58 protected: |
| 61 virtual bool DoesDelete() { return true; } | 59 virtual bool DoesDelete(); |
| 62 virtual bool DoesGet() { return true; } | 60 virtual bool DoesGet(); |
| 63 | 61 |
| 64 virtual void ExecuteDelete(Response* const response); | 62 virtual void ExecuteDelete(Response* const response); |
| 65 virtual void ExecuteGet(Response* const response); | 63 virtual void ExecuteGet(Response* const response); |
| 66 | 64 |
| 67 private: | 65 private: |
| 68 GURL current_url_; | 66 GURL current_url_; |
| 69 std::string cookie_name_; | 67 std::string cookie_name_; |
| 70 | 68 |
| 71 DISALLOW_COPY_AND_ASSIGN(NamedCookieCommand); | 69 DISALLOW_COPY_AND_ASSIGN(NamedCookieCommand); |
| 72 }; | 70 }; |
| 73 | 71 |
| 74 } // namespace webdriver | 72 } // namespace webdriver |
| 75 | 73 |
| 76 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_ | 74 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_ |
| 77 | 75 |
| OLD | NEW |