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 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 8#include <string> 9#include <vector> 10 11#include "chrome/test/webdriver/commands/webdriver_command.h" 12#include "url/gurl.h" 13 14namespace base { 15class DictionaryValue; 16} 17 18namespace webdriver { 19 20class Response; 21 22// Retrieve all cookies visible to the current page. Each cookie will be 23// returned as a JSON object with the following properties: 24// name, value, path, domain, secure, and expiry. See: 25// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/cookie 26class CookieCommand : public WebDriverCommand { 27 public: 28 CookieCommand(const std::vector<std::string>& path_segments, 29 const base::DictionaryValue* const parameters); 30 virtual ~CookieCommand(); 31 32 virtual bool DoesDelete() OVERRIDE; 33 virtual bool DoesGet() OVERRIDE; 34 virtual bool DoesPost() OVERRIDE; 35 36 virtual void ExecuteDelete(Response* const response) OVERRIDE; 37 virtual void ExecuteGet(Response* const response) OVERRIDE; 38 virtual void ExecutePost(Response* const response) OVERRIDE; 39 40 private: 41 DISALLOW_COPY_AND_ASSIGN(CookieCommand); 42}; 43 44// Set a cookie. The cookie should be specified as a JSON object with the 45// following properties: name, value, path, domain, secure, and expiry. See: 46// http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/cookie/:name 47class NamedCookieCommand : public WebDriverCommand { 48 public: 49 NamedCookieCommand(const std::vector<std::string>& path_segments, 50 const base::DictionaryValue* const parameters); 51 virtual ~NamedCookieCommand(); 52 53 virtual bool Init(Response* const response) OVERRIDE; 54 55 virtual bool DoesDelete() OVERRIDE; 56 57 virtual void ExecuteDelete(Response* const response) OVERRIDE; 58 59 private: 60 std::string cookie_name_; 61 62 DISALLOW_COPY_AND_ASSIGN(NamedCookieCommand); 63}; 64 65} // namespace webdriver 66 67#endif // CHROME_TEST_WEBDRIVER_COMMANDS_COOKIE_COMMANDS_H_ 68