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; |
72 // }; | 75 // }; |
73 | 76 |
74 template <class CookieStoreTestTraits> | 77 template <class CookieStoreTestTraits> |
75 class CookieStoreTest : public testing::Test { | 78 class CookieStoreTest : public testing::Test { |
76 protected: | 79 protected: |
77 CookieStoreTest() | 80 CookieStoreTest() |
78 : http_www_google_("http://www.google.izzle"), | 81 : http_www_google_("http://www.google.izzle"), |
79 https_www_google_("https://www.google.izzle"), | 82 https_www_google_("https://www.google.izzle"), |
80 ftp_google_("ftp://ftp.google.izzle/"), | 83 ftp_google_("ftp://ftp.google.izzle/"), |
81 ws_www_google_("ws://www.google.izzle"), | 84 ws_www_google_("ws://www.google.izzle"), |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 options.set_server_time(server_time); | 151 options.set_server_time(server_time); |
149 return SetCookieWithOptions(cs, url, cookie_line, options); | 152 return SetCookieWithOptions(cs, url, cookie_line, options); |
150 } | 153 } |
151 | 154 |
152 bool SetCookie(CookieStore* cs, | 155 bool SetCookie(CookieStore* cs, |
153 const GURL& url, | 156 const GURL& url, |
154 const std::string& cookie_line) { | 157 const std::string& cookie_line) { |
155 CookieOptions options; | 158 CookieOptions options; |
156 if (!CookieStoreTestTraits::supports_http_only) | 159 if (!CookieStoreTestTraits::supports_http_only) |
157 options.set_include_httponly(); | 160 options.set_include_httponly(); |
| 161 if (CookieStoreTestTraits::enforces_prefixes) |
| 162 options.set_enforce_prefixes(); |
158 return SetCookieWithOptions(cs, url, cookie_line, options); | 163 return SetCookieWithOptions(cs, url, cookie_line, options); |
159 } | 164 } |
160 | 165 |
161 void DeleteCookie(CookieStore* cs, | 166 void DeleteCookie(CookieStore* cs, |
162 const GURL& url, | 167 const GURL& url, |
163 const std::string& cookie_name) { | 168 const std::string& cookie_name) { |
164 DCHECK(cs); | 169 DCHECK(cs); |
165 NoResultCookieCallback callback; | 170 NoResultCookieCallback callback; |
166 cs->DeleteCookieAsync( | 171 cs->DeleteCookieAsync( |
167 url, cookie_name, | 172 url, cookie_name, |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, | 1242 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, |
1238 ThreadCheckGetCookies, | 1243 ThreadCheckGetCookies, |
1239 ThreadCheckGetCookiesWithOptions, | 1244 ThreadCheckGetCookiesWithOptions, |
1240 ThreadCheckSetCookieWithOptions, | 1245 ThreadCheckSetCookieWithOptions, |
1241 ThreadCheckDeleteCookie, | 1246 ThreadCheckDeleteCookie, |
1242 ThreadCheckDeleteSessionCookies); | 1247 ThreadCheckDeleteSessionCookies); |
1243 | 1248 |
1244 } // namespace net | 1249 } // namespace net |
1245 | 1250 |
1246 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 1251 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
OLD | NEW |