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