| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 5 #ifndef NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
| 6 #define NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 6 #define NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // // The cookie store rejects cookies for invalid schemes such as ftp. | 62 // // The cookie store rejects cookies for invalid schemes such as ftp. |
| 63 // static const bool filters_schemes; | 63 // static const bool filters_schemes; |
| 64 // | 64 // |
| 65 // // The cookie store has a bug happening when a path is a substring of | 65 // // The cookie store has a bug happening when a path is a substring of |
| 66 // // another. | 66 // // another. |
| 67 // static const bool has_path_prefix_bug; | 67 // static const bool has_path_prefix_bug; |
| 68 // | 68 // |
| 69 // // Time to wait between two cookie insertions to ensure that cookies have | 69 // // Time to wait between two cookie insertions to ensure that cookies have |
| 70 // // different creation times. | 70 // // different creation times. |
| 71 // static const int creation_time_granularity_in_ms; | 71 // static const int creation_time_granularity_in_ms; |
| 72 // | |
| 73 // // The cookie store enforces cookie prefixes. | |
| 74 // static const bool enforces_prefixes; | |
| 75 // }; | 72 // }; |
| 76 | 73 |
| 77 template <class CookieStoreTestTraits> | 74 template <class CookieStoreTestTraits> |
| 78 class CookieStoreTest : public testing::Test { | 75 class CookieStoreTest : public testing::Test { |
| 79 protected: | 76 protected: |
| 80 CookieStoreTest() | 77 CookieStoreTest() |
| 81 : http_www_google_("http://www.google.izzle"), | 78 : http_www_google_("http://www.google.izzle"), |
| 82 https_www_google_("https://www.google.izzle"), | 79 https_www_google_("https://www.google.izzle"), |
| 83 ftp_google_("ftp://ftp.google.izzle/"), | 80 ftp_google_("ftp://ftp.google.izzle/"), |
| 84 ws_www_google_("ws://www.google.izzle"), | 81 ws_www_google_("ws://www.google.izzle"), |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 options.set_server_time(server_time); | 148 options.set_server_time(server_time); |
| 152 return SetCookieWithOptions(cs, url, cookie_line, options); | 149 return SetCookieWithOptions(cs, url, cookie_line, options); |
| 153 } | 150 } |
| 154 | 151 |
| 155 bool SetCookie(CookieStore* cs, | 152 bool SetCookie(CookieStore* cs, |
| 156 const GURL& url, | 153 const GURL& url, |
| 157 const std::string& cookie_line) { | 154 const std::string& cookie_line) { |
| 158 CookieOptions options; | 155 CookieOptions options; |
| 159 if (!CookieStoreTestTraits::supports_http_only) | 156 if (!CookieStoreTestTraits::supports_http_only) |
| 160 options.set_include_httponly(); | 157 options.set_include_httponly(); |
| 161 if (CookieStoreTestTraits::enforces_prefixes) | |
| 162 options.set_enforce_prefixes(); | |
| 163 return SetCookieWithOptions(cs, url, cookie_line, options); | 158 return SetCookieWithOptions(cs, url, cookie_line, options); |
| 164 } | 159 } |
| 165 | 160 |
| 166 void DeleteCookie(CookieStore* cs, | 161 void DeleteCookie(CookieStore* cs, |
| 167 const GURL& url, | 162 const GURL& url, |
| 168 const std::string& cookie_name) { | 163 const std::string& cookie_name) { |
| 169 DCHECK(cs); | 164 DCHECK(cs); |
| 170 NoResultCookieCallback callback; | 165 NoResultCookieCallback callback; |
| 171 cs->DeleteCookieAsync( | 166 cs->DeleteCookieAsync( |
| 172 url, cookie_name, | 167 url, cookie_name, |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, | 1237 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, |
| 1243 ThreadCheckGetCookies, | 1238 ThreadCheckGetCookies, |
| 1244 ThreadCheckGetCookiesWithOptions, | 1239 ThreadCheckGetCookiesWithOptions, |
| 1245 ThreadCheckSetCookieWithOptions, | 1240 ThreadCheckSetCookieWithOptions, |
| 1246 ThreadCheckDeleteCookie, | 1241 ThreadCheckDeleteCookie, |
| 1247 ThreadCheckDeleteSessionCookies); | 1242 ThreadCheckDeleteSessionCookies); |
| 1248 | 1243 |
| 1249 } // namespace net | 1244 } // namespace net |
| 1250 | 1245 |
| 1251 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 1246 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
| OLD | NEW |