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_COOKIE_H_ |
| 6 #define CHROME_TEST_WEBDRIVER_COOKIE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/values.h" |
| 12 |
| 13 namespace webdriver { |
| 14 |
| 15 // Class used to convert cookies to various formats. |
| 16 class Cookie { |
| 17 public: |
| 18 explicit Cookie(const std::string& cookie); |
| 19 explicit Cookie(const DictionaryValue& dict); |
| 20 |
| 21 DictionaryValue* ToDictionary(); |
| 22 // ToJSONString() returns a string form of a JSON object with the required |
| 23 // WebDriver tags. Note that this format cannot be used to set a cookie in |
| 24 // the chrome browser. Example { "name"="foo", "value"="bar"} |
| 25 std::string ToJSONString(); |
| 26 // ToString() returns a string format expected by chrome to for a cookie. |
| 27 // Example: "foo=bar" |
| 28 std::string ToString(); |
| 29 |
| 30 bool valid() const { return valid_; } |
| 31 const std::string& name() const { return name_; } |
| 32 |
| 33 private: |
| 34 std::string name_; |
| 35 std::string value_; |
| 36 std::string path_; |
| 37 std::string domain_; |
| 38 std::string expires_; |
| 39 bool secure_; |
| 40 bool http_; |
| 41 bool valid_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(Cookie); |
| 44 }; |
| 45 |
| 46 } // namespace webdriver |
| 47 |
| 48 #endif // CHROME_TEST_WEBDRIVER_COOKIE_H_ |
OLD | NEW |