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/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_tokenizer.h" | 10 #include "base/string_tokenizer.h" |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 | 1088 |
1089 TYPED_TEST_P(MultiThreadedCookieStoreTest, ThreadCheckDeleteSessionCookies) { | 1089 TYPED_TEST_P(MultiThreadedCookieStoreTest, ThreadCheckDeleteSessionCookies) { |
1090 scoped_refptr<CookieStore> cs(this->GetCookieStore()); | 1090 scoped_refptr<CookieStore> cs(this->GetCookieStore()); |
1091 CookieOptions options; | 1091 CookieOptions options; |
1092 if (!TypeParam::supports_http_only) | 1092 if (!TypeParam::supports_http_only) |
1093 options.set_include_httponly(); | 1093 options.set_include_httponly(); |
1094 EXPECT_TRUE(this->SetCookieWithOptions(cs, this->url_google_, | 1094 EXPECT_TRUE(this->SetCookieWithOptions(cs, this->url_google_, |
1095 "A=B", options)); | 1095 "A=B", options)); |
1096 EXPECT_TRUE(this->SetCookieWithOptions(cs, this->url_google_, | 1096 EXPECT_TRUE(this->SetCookieWithOptions(cs, this->url_google_, |
1097 "B=C; expires=Mon, 18-Apr-22 22:50:13 GMT", options)); | 1097 "B=C; expires=Mon, 18-Apr-22 22:50:13 GMT", options)); |
1098 | 1098 EXPECT_EQ(1, this->DeleteSessionCookies(cs)); |
1099 #if defined(ENABLE_PERSISTENT_SESSION_COOKIES) | |
1100 EXPECT_EQ(0, this->DeleteSessionCookies(cs)); | 1099 EXPECT_EQ(0, this->DeleteSessionCookies(cs)); |
1101 #else | |
1102 EXPECT_EQ(1, this->DeleteSessionCookies(cs)); | |
1103 #endif | |
1104 | |
1105 EXPECT_EQ(0, this->DeleteSessionCookies(cs)); | |
1106 | |
1107 EXPECT_TRUE(this->SetCookieWithOptions(cs, this->url_google_, | 1100 EXPECT_TRUE(this->SetCookieWithOptions(cs, this->url_google_, |
1108 "A=B", options)); | 1101 "A=B", options)); |
1109 DeleteCallback callback(&this->other_thread_); | 1102 DeleteCallback callback(&this->other_thread_); |
1110 base::Closure task = base::Bind( | 1103 base::Closure task = base::Bind( |
1111 &net::MultiThreadedCookieStoreTest<TypeParam>::DeleteSessionCookiesTask, | 1104 &net::MultiThreadedCookieStoreTest<TypeParam>::DeleteSessionCookiesTask, |
1112 base::Unretained(this), | 1105 base::Unretained(this), |
1113 cs, &callback); | 1106 cs, &callback); |
1114 this->RunOnOtherThread(task); | 1107 this->RunOnOtherThread(task); |
1115 EXPECT_TRUE(callback.did_run()); | 1108 EXPECT_TRUE(callback.did_run()); |
1116 | |
1117 #if defined(ENABLE_PERSISTENT_SESSION_COOKIES) | |
1118 EXPECT_EQ(0, callback.num_deleted()); | |
1119 #else | |
1120 EXPECT_EQ(1, callback.num_deleted()); | 1109 EXPECT_EQ(1, callback.num_deleted()); |
1121 #endif | |
1122 } | 1110 } |
1123 | 1111 |
1124 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, | 1112 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, |
1125 ThreadCheckGetCookies, ThreadCheckGetCookiesWithOptions, | 1113 ThreadCheckGetCookies, ThreadCheckGetCookiesWithOptions, |
1126 ThreadCheckGetCookiesWithInfo, ThreadCheckSetCookieWithOptions, | 1114 ThreadCheckGetCookiesWithInfo, ThreadCheckSetCookieWithOptions, |
1127 ThreadCheckDeleteCookie, ThreadCheckDeleteSessionCookies); | 1115 ThreadCheckDeleteCookie, ThreadCheckDeleteSessionCookies); |
1128 | 1116 |
1129 } // namespace net | 1117 } // namespace net |
1130 | 1118 |
1131 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 1119 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
OLD | NEW |