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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 using base::Thread; | 36 using base::Thread; |
37 | 37 |
38 const int kTimeout = 1000; | 38 const int kTimeout = 1000; |
39 | 39 |
40 const char kValidCookieLine[] = "A=B; path=/"; | 40 const char kValidCookieLine[] = "A=B; path=/"; |
41 | 41 |
42 // The CookieStoreTestTraits must have the following members: | 42 // The CookieStoreTestTraits must have the following members: |
43 // struct CookieStoreTestTraits { | 43 // struct CookieStoreTestTraits { |
44 // // Factory function. Will be called at most once per test. | 44 // // Factory function. Will be called at most once per test. |
45 // static scoped_ptr<CookieStore> Create(); | 45 // static std::unique_ptr<CookieStore> Create(); |
46 // | 46 // |
47 // // The cookie store supports cookies with the exclude_httponly() option. | 47 // // The cookie store supports cookies with the exclude_httponly() option. |
48 // static const bool supports_http_only; | 48 // static const bool supports_http_only; |
49 // | 49 // |
50 // // The cookie store is able to make the difference between the ".com" | 50 // // The cookie store is able to make the difference between the ".com" |
51 // // and the "com" domains. | 51 // // and the "com" domains. |
52 // static const bool supports_non_dotted_domains; | 52 // static const bool supports_non_dotted_domains; |
53 // | 53 // |
54 // // The cookie store does not fold domains with trailing dots (so "com." and | 54 // // The cookie store does not fold domains with trailing dots (so "com." and |
55 // "com" are different domains). | 55 // "com" are different domains). |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 const CookieURLHelper http_www_google_; | 312 const CookieURLHelper http_www_google_; |
313 const CookieURLHelper https_www_google_; | 313 const CookieURLHelper https_www_google_; |
314 const CookieURLHelper ftp_google_; | 314 const CookieURLHelper ftp_google_; |
315 const CookieURLHelper ws_www_google_; | 315 const CookieURLHelper ws_www_google_; |
316 const CookieURLHelper wss_www_google_; | 316 const CookieURLHelper wss_www_google_; |
317 const CookieURLHelper www_google_foo_; | 317 const CookieURLHelper www_google_foo_; |
318 const CookieURLHelper www_google_bar_; | 318 const CookieURLHelper www_google_bar_; |
319 const CookieURLHelper http_foo_com_; | 319 const CookieURLHelper http_foo_com_; |
320 const CookieURLHelper http_bar_com_; | 320 const CookieURLHelper http_bar_com_; |
321 | 321 |
322 scoped_ptr<base::WeakPtrFactory<base::MessageLoop> > weak_factory_; | 322 std::unique_ptr<base::WeakPtrFactory<base::MessageLoop>> weak_factory_; |
323 scoped_ptr<base::MessageLoop> message_loop_; | 323 std::unique_ptr<base::MessageLoop> message_loop_; |
324 | 324 |
325 private: | 325 private: |
326 // Returns a set of strings of type "name=value". Fails in case of duplicate. | 326 // Returns a set of strings of type "name=value". Fails in case of duplicate. |
327 std::set<std::string> TokenizeCookieLine(const std::string& line) { | 327 std::set<std::string> TokenizeCookieLine(const std::string& line) { |
328 std::set<std::string> tokens; | 328 std::set<std::string> tokens; |
329 base::StringTokenizer tokenizer(line, " ;"); | 329 base::StringTokenizer tokenizer(line, " ;"); |
330 while (tokenizer.GetNext()) | 330 while (tokenizer.GetNext()) |
331 EXPECT_TRUE(tokens.insert(tokenizer.token()).second); | 331 EXPECT_TRUE(tokens.insert(tokenizer.token()).second); |
332 return tokens; | 332 return tokens; |
333 } | 333 } |
334 | 334 |
335 scoped_ptr<CookieStore> cookie_store_; | 335 std::unique_ptr<CookieStore> cookie_store_; |
336 }; | 336 }; |
337 | 337 |
338 TYPED_TEST_CASE_P(CookieStoreTest); | 338 TYPED_TEST_CASE_P(CookieStoreTest); |
339 | 339 |
340 TYPED_TEST_P(CookieStoreTest, SetCookieWithDetailsAsync) { | 340 TYPED_TEST_P(CookieStoreTest, SetCookieWithDetailsAsync) { |
341 CookieStore* cs = this->GetCookieStore(); | 341 CookieStore* cs = this->GetCookieStore(); |
342 | 342 |
343 base::Time two_hours_ago = base::Time::Now() - base::TimeDelta::FromHours(2); | 343 base::Time two_hours_ago = base::Time::Now() - base::TimeDelta::FromHours(2); |
344 base::Time one_hour_ago = base::Time::Now() - base::TimeDelta::FromHours(1); | 344 base::Time one_hour_ago = base::Time::Now() - base::TimeDelta::FromHours(1); |
345 base::Time one_hour_from_now = | 345 base::Time one_hour_from_now = |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 OverwritePersistentCookie, | 1408 OverwritePersistentCookie, |
1409 CookieOrdering, | 1409 CookieOrdering, |
1410 GetAllCookiesAsync, | 1410 GetAllCookiesAsync, |
1411 DeleteCookieAsync, | 1411 DeleteCookieAsync, |
1412 DeleteCanonicalCookieAsync, | 1412 DeleteCanonicalCookieAsync, |
1413 DeleteSessionCookie); | 1413 DeleteSessionCookie); |
1414 | 1414 |
1415 } // namespace net | 1415 } // namespace net |
1416 | 1416 |
1417 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 1417 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
OLD | NEW |