| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 namespace base { |
| 15 class DictionaryValue; | 16 class DictionaryValue; |
| 17 } |
| 16 | 18 |
| 17 namespace webdriver { | 19 namespace webdriver { |
| 18 | 20 |
| 19 class Response; | 21 class Response; |
| 20 | 22 |
| 21 // Retrieve all cookies visible to the current page. Each cookie will be | 23 // Retrieve all cookies visible to the current page. Each cookie will be |
| 22 // returned as a JSON object with the following properties: | 24 // returned as a JSON object with the following properties: |
| 23 // name, value, path, domain, secure, and expiry. See: | 25 // name, value, path, domain, secure, and expiry. See: |
| 24 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/c
ookie | 26 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/c
ookie |
| 25 class CookieCommand : public WebDriverCommand { | 27 class CookieCommand : public WebDriverCommand { |
| 26 public: | 28 public: |
| 27 CookieCommand(const std::vector<std::string>& path_segments, | 29 CookieCommand(const std::vector<std::string>& path_segments, |
| 28 const DictionaryValue* const parameters); | 30 const base::DictionaryValue* const parameters); |
| 29 virtual ~CookieCommand(); | 31 virtual ~CookieCommand(); |
| 30 | 32 |
| 31 virtual bool Init(Response* const response); | 33 virtual bool Init(Response* const response); |
| 32 | 34 |
| 33 virtual bool DoesDelete(); | 35 virtual bool DoesDelete(); |
| 34 virtual bool DoesGet(); | 36 virtual bool DoesGet(); |
| 35 virtual bool DoesPost(); | 37 virtual bool DoesPost(); |
| 36 | 38 |
| 37 virtual void ExecuteDelete(Response* const response); | 39 virtual void ExecuteDelete(Response* const response); |
| 38 virtual void ExecuteGet(Response* const response); | 40 virtual void ExecuteGet(Response* const response); |
| 39 virtual void ExecutePost(Response* const response); | 41 virtual void ExecutePost(Response* const response); |
| 40 | 42 |
| 41 private: | 43 private: |
| 42 GURL current_url_; | 44 GURL current_url_; |
| 43 bool uses_new_interface_; | 45 bool uses_new_interface_; |
| 44 | 46 |
| 45 DISALLOW_COPY_AND_ASSIGN(CookieCommand); | 47 DISALLOW_COPY_AND_ASSIGN(CookieCommand); |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 // Set a cookie. The cookie should be specified as a JSON object with the | 50 // 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: | 51 // following properties: name, value, path, domain, secure, and expiry. See: |
| 50 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/c
ookie/:name | 52 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/c
ookie/:name |
| 51 class NamedCookieCommand : public WebDriverCommand { | 53 class NamedCookieCommand : public WebDriverCommand { |
| 52 public: | 54 public: |
| 53 NamedCookieCommand(const std::vector<std::string>& path_segments, | 55 NamedCookieCommand(const std::vector<std::string>& path_segments, |
| 54 const DictionaryValue* const parameters); | 56 const base::DictionaryValue* const parameters); |
| 55 virtual ~NamedCookieCommand(); | 57 virtual ~NamedCookieCommand(); |
| 56 | 58 |
| 57 virtual bool Init(Response* const response); | 59 virtual bool Init(Response* const response); |
| 58 | 60 |
| 59 protected: | 61 protected: |
| 60 virtual bool DoesDelete(); | 62 virtual bool DoesDelete(); |
| 61 | 63 |
| 62 virtual void ExecuteDelete(Response* const response); | 64 virtual void ExecuteDelete(Response* const response); |
| 63 | 65 |
| 64 private: | 66 private: |
| 65 GURL current_url_; | 67 GURL current_url_; |
| 66 std::string cookie_name_; | 68 std::string cookie_name_; |
| 67 bool uses_new_interface_; | 69 bool uses_new_interface_; |
| 68 | 70 |
| 69 DISALLOW_COPY_AND_ASSIGN(NamedCookieCommand); | 71 DISALLOW_COPY_AND_ASSIGN(NamedCookieCommand); |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 } // namespace webdriver | 74 } // namespace webdriver |
| 73 | 75 |
| 74 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_ | 76 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_ |
| OLD | NEW |