| 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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 | 1293 |
| 1294 ASSERT_TRUE(++it != cookies.end()); | 1294 ASSERT_TRUE(++it != cookies.end()); |
| 1295 EXPECT_EQ(this->http_foo_com_.host(), it->Domain()); | 1295 EXPECT_EQ(this->http_foo_com_.host(), it->Domain()); |
| 1296 EXPECT_EQ("/", it->Path()); | 1296 EXPECT_EQ("/", it->Path()); |
| 1297 EXPECT_EQ("C", it->Name()); | 1297 EXPECT_EQ("C", it->Name()); |
| 1298 EXPECT_EQ("D", it->Value()); | 1298 EXPECT_EQ("D", it->Value()); |
| 1299 | 1299 |
| 1300 ASSERT_TRUE(++it == cookies.end()); | 1300 ASSERT_TRUE(++it == cookies.end()); |
| 1301 } | 1301 } |
| 1302 | 1302 |
| 1303 TYPED_TEST_P(CookieStoreTest, DeleteCookieAsync) { | |
| 1304 scoped_refptr<CookieStore> cs(this->GetCookieStore()); | |
| 1305 | |
| 1306 EXPECT_TRUE( | |
| 1307 this->SetCookie(cs.get(), this->http_www_google_.url(), "A=A1; path=/")); | |
| 1308 EXPECT_TRUE(this->SetCookie(cs.get(), this->http_www_google_.url(), | |
| 1309 "A=A2; path=/foo")); | |
| 1310 EXPECT_TRUE(this->SetCookie(cs.get(), this->http_www_google_.url(), | |
| 1311 "A=A3; path=/bar")); | |
| 1312 EXPECT_TRUE( | |
| 1313 this->SetCookie(cs.get(), this->http_www_google_.url(), "B=B1; path=/")); | |
| 1314 EXPECT_TRUE(this->SetCookie(cs.get(), this->http_www_google_.url(), | |
| 1315 "B=B2; path=/foo")); | |
| 1316 EXPECT_TRUE(this->SetCookie(cs.get(), this->http_www_google_.url(), | |
| 1317 "B=B3; path=/bar")); | |
| 1318 | |
| 1319 this->DeleteCookie(cs.get(), this->http_www_google_.AppendPath("foo/bar"), | |
| 1320 "A"); | |
| 1321 | |
| 1322 CookieList cookies = this->GetAllCookies(cs.get()); | |
| 1323 size_t expected_size = 4; | |
| 1324 EXPECT_EQ(expected_size, cookies.size()); | |
| 1325 for (const auto& cookie : cookies) { | |
| 1326 EXPECT_NE("A1", cookie.Value()); | |
| 1327 EXPECT_NE("A2", cookie.Value()); | |
| 1328 } | |
| 1329 } | |
| 1330 | |
| 1331 TYPED_TEST_P(CookieStoreTest, DeleteCanonicalCookieAsync) { | 1303 TYPED_TEST_P(CookieStoreTest, DeleteCanonicalCookieAsync) { |
| 1332 scoped_refptr<CookieStore> cs(this->GetCookieStore()); | 1304 scoped_refptr<CookieStore> cs(this->GetCookieStore()); |
| 1333 | 1305 |
| 1334 // Set two cookies with the same name, and make sure both are set. | 1306 // Set two cookies with the same name, and make sure both are set. |
| 1335 EXPECT_TRUE( | 1307 EXPECT_TRUE( |
| 1336 this->SetCookie(cs.get(), this->http_www_google_.url(), "A=B;Path=/foo")); | 1308 this->SetCookie(cs.get(), this->http_www_google_.url(), "A=B;Path=/foo")); |
| 1337 EXPECT_TRUE( | 1309 EXPECT_TRUE( |
| 1338 this->SetCookie(cs.get(), this->http_www_google_.url(), "A=C;Path=/bar")); | 1310 this->SetCookie(cs.get(), this->http_www_google_.url(), "A=C;Path=/bar")); |
| 1339 EXPECT_EQ(2u, this->GetAllCookies(cs.get()).size()); | 1311 EXPECT_EQ(2u, this->GetAllCookies(cs.get()).size()); |
| 1340 EXPECT_EQ("A=B", this->GetCookies(cs.get(), this->www_google_foo_.url())); | 1312 EXPECT_EQ("A=B", this->GetCookies(cs.get(), this->www_google_foo_.url())); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1415 HttpOnlyTest, | 1387 HttpOnlyTest, |
| 1416 TestCookieDeletion, | 1388 TestCookieDeletion, |
| 1417 TestDeleteAll, | 1389 TestDeleteAll, |
| 1418 TestDeleteAllCreatedBetween, | 1390 TestDeleteAllCreatedBetween, |
| 1419 TestDeleteAllCreatedBetweenForHost, | 1391 TestDeleteAllCreatedBetweenForHost, |
| 1420 TestSecure, | 1392 TestSecure, |
| 1421 NetUtilCookieTest, | 1393 NetUtilCookieTest, |
| 1422 OverwritePersistentCookie, | 1394 OverwritePersistentCookie, |
| 1423 CookieOrdering, | 1395 CookieOrdering, |
| 1424 GetAllCookiesAsync, | 1396 GetAllCookiesAsync, |
| 1425 DeleteCookieAsync, | |
| 1426 DeleteCanonicalCookieAsync, | 1397 DeleteCanonicalCookieAsync, |
| 1427 DeleteSessionCookie); | 1398 DeleteSessionCookie); |
| 1428 | 1399 |
| 1429 } // namespace net | 1400 } // namespace net |
| 1430 | 1401 |
| 1431 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 1402 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
| OLD | NEW |