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 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
6 | 6 |
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/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 scoped_refptr<CannedBrowsingDataCookieHelper> helper( | 271 scoped_refptr<CannedBrowsingDataCookieHelper> helper( |
272 new CannedBrowsingDataCookieHelper( | 272 new CannedBrowsingDataCookieHelper( |
273 testing_profile_->GetRequestContext())); | 273 testing_profile_->GetRequestContext())); |
274 | 274 |
275 ASSERT_TRUE(helper->empty()); | 275 ASSERT_TRUE(helper->empty()); |
276 helper->AddChangedCookie(origin, origin, "A=1", net::CookieOptions()); | 276 helper->AddChangedCookie(origin, origin, "A=1", net::CookieOptions()); |
277 helper->AddChangedCookie(origin, origin, "A=1; Domain=.www.google.com", | 277 helper->AddChangedCookie(origin, origin, "A=1; Domain=.www.google.com", |
278 net::CookieOptions()); | 278 net::CookieOptions()); |
279 // Try adding invalid cookies that will be ignored. | 279 // Try adding invalid cookies that will be ignored. |
280 helper->AddChangedCookie(origin, origin, "", net::CookieOptions()); | 280 helper->AddChangedCookie(origin, origin, std::string(), net::CookieOptions()); |
281 helper->AddChangedCookie(origin, origin, "C=bad guy; Domain=wrongdomain.com", | 281 helper->AddChangedCookie(origin, |
| 282 origin, |
| 283 "C=bad guy; Domain=wrongdomain.com", |
282 net::CookieOptions()); | 284 net::CookieOptions()); |
283 | 285 |
284 helper->StartFetching( | 286 helper->StartFetching( |
285 base::Bind(&BrowsingDataCookieHelperTest::CannedDomainCookieCallback, | 287 base::Bind(&BrowsingDataCookieHelperTest::CannedDomainCookieCallback, |
286 base::Unretained(this))); | 288 base::Unretained(this))); |
287 cookie = cookie_list_; | 289 cookie = cookie_list_; |
288 | 290 |
289 helper->Reset(); | 291 helper->Reset(); |
290 ASSERT_TRUE(helper->empty()); | 292 ASSERT_TRUE(helper->empty()); |
291 | 293 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 // "A=1; | 481 // "A=1; |
480 // "A=3; Domain=www.google.com" | 482 // "A=3; Domain=www.google.com" |
481 // Add a domain cookie and check if it increases the cookie count. | 483 // Add a domain cookie and check if it increases the cookie count. |
482 helper->AddChangedCookie(frame2_url, frame1_url, | 484 helper->AddChangedCookie(frame2_url, frame1_url, |
483 cookie_pair4 + "; Domain=" + cookie_domain, | 485 cookie_pair4 + "; Domain=" + cookie_domain, |
484 net::CookieOptions()); | 486 net::CookieOptions()); |
485 EXPECT_EQ(5U, helper->GetCookieCount()); | 487 EXPECT_EQ(5U, helper->GetCookieCount()); |
486 } | 488 } |
487 | 489 |
488 } // namespace | 490 } // namespace |
OLD | NEW |