| 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 "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // // The cookie store rejects cookies for invalid schemes such as ftp. | 65 // // The cookie store rejects cookies for invalid schemes such as ftp. |
| 66 // static const bool filters_schemes; | 66 // static const bool filters_schemes; |
| 67 // | 67 // |
| 68 // // The cookie store has a bug happening when a path is a substring of | 68 // // The cookie store has a bug happening when a path is a substring of |
| 69 // // another. | 69 // // another. |
| 70 // static const bool has_path_prefix_bug; | 70 // static const bool has_path_prefix_bug; |
| 71 // | 71 // |
| 72 // // Time to wait between two cookie insertions to ensure that cookies have | 72 // // Time to wait between two cookie insertions to ensure that cookies have |
| 73 // // different creation times. | 73 // // different creation times. |
| 74 // static const int creation_time_granularity_in_ms; | 74 // static const int creation_time_granularity_in_ms; |
| 75 // |
| 76 // // The cookie store enforces cookie prefixes. |
| 77 // static const bool enforces_prefixes; |
| 75 // }; | 78 // }; |
| 76 | 79 |
| 77 template <class CookieStoreTestTraits> | 80 template <class CookieStoreTestTraits> |
| 78 class CookieStoreTest : public testing::Test { | 81 class CookieStoreTest : public testing::Test { |
| 79 protected: | 82 protected: |
| 80 CookieStoreTest() | 83 CookieStoreTest() |
| 81 : url_google_(kUrlGoogle), | 84 : url_google_(kUrlGoogle), |
| 82 url_google_secure_(kUrlGoogleSecure), | 85 url_google_secure_(kUrlGoogleSecure), |
| 83 url_google_foo_(kUrlGoogleFoo), | 86 url_google_foo_(kUrlGoogleFoo), |
| 84 url_google_bar_(kUrlGoogleBar) { | 87 url_google_bar_(kUrlGoogleBar) { |
| (...skipping 63 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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, | 1205 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, |
| 1201 ThreadCheckGetCookies, | 1206 ThreadCheckGetCookies, |
| 1202 ThreadCheckGetCookiesWithOptions, | 1207 ThreadCheckGetCookiesWithOptions, |
| 1203 ThreadCheckSetCookieWithOptions, | 1208 ThreadCheckSetCookieWithOptions, |
| 1204 ThreadCheckDeleteCookie, | 1209 ThreadCheckDeleteCookie, |
| 1205 ThreadCheckDeleteSessionCookies); | 1210 ThreadCheckDeleteSessionCookies); |
| 1206 | 1211 |
| 1207 } // namespace net | 1212 } // namespace net |
| 1208 | 1213 |
| 1209 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 1214 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
| OLD | NEW |