Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: net/cookies/cookie_store_unittest.h

Issue 1746303002: Replace std::string::find with base::StartsWith when comparing cookie paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove new test case Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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"));
mmenke 2016/03/02 20:02:01 I tried adding a "path=/fo" test, but iOS apparent
Mike West 2016/03/03 18:56:28 What? What does iOS do?
mmenke 2016/03/03 19:02:58 iOS seems to return (Or at least delete, think ret
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
1303 TYPED_TEST_P(CookieStoreTest, DeleteCanonicalCookieAsync) { 1331 TYPED_TEST_P(CookieStoreTest, DeleteCanonicalCookieAsync) {
1304 scoped_refptr<CookieStore> cs(this->GetCookieStore()); 1332 scoped_refptr<CookieStore> cs(this->GetCookieStore());
1305 1333
1306 // Set two cookies with the same name, and make sure both are set. 1334 // Set two cookies with the same name, and make sure both are set.
1307 EXPECT_TRUE( 1335 EXPECT_TRUE(
1308 this->SetCookie(cs.get(), this->http_www_google_.url(), "A=B;Path=/foo")); 1336 this->SetCookie(cs.get(), this->http_www_google_.url(), "A=B;Path=/foo"));
1309 EXPECT_TRUE( 1337 EXPECT_TRUE(
1310 this->SetCookie(cs.get(), this->http_www_google_.url(), "A=C;Path=/bar")); 1338 this->SetCookie(cs.get(), this->http_www_google_.url(), "A=C;Path=/bar"));
1311 EXPECT_EQ(2u, this->GetAllCookies(cs.get()).size()); 1339 EXPECT_EQ(2u, this->GetAllCookies(cs.get()).size());
1312 EXPECT_EQ("A=B", this->GetCookies(cs.get(), this->www_google_foo_.url())); 1340 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
1387 HttpOnlyTest, 1415 HttpOnlyTest,
1388 TestCookieDeletion, 1416 TestCookieDeletion,
1389 TestDeleteAll, 1417 TestDeleteAll,
1390 TestDeleteAllCreatedBetween, 1418 TestDeleteAllCreatedBetween,
1391 TestDeleteAllCreatedBetweenForHost, 1419 TestDeleteAllCreatedBetweenForHost,
1392 TestSecure, 1420 TestSecure,
1393 NetUtilCookieTest, 1421 NetUtilCookieTest,
1394 OverwritePersistentCookie, 1422 OverwritePersistentCookie,
1395 CookieOrdering, 1423 CookieOrdering,
1396 GetAllCookiesAsync, 1424 GetAllCookiesAsync,
1425 DeleteCookieAsync,
1397 DeleteCanonicalCookieAsync, 1426 DeleteCanonicalCookieAsync,
1398 DeleteSessionCookie); 1427 DeleteSessionCookie);
1399 1428
1400 } // namespace net 1429 } // namespace net
1401 1430
1402 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ 1431 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_
OLDNEW
« net/cookies/cookie_monster.cc ('K') | « net/cookies/cookie_monster_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698