Chromium Code Reviews| Index: chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc |
| diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc |
| index 7e02b8352514912eb78b27ffe250f0363abce969..292057e4a2e2592479ed116a016d5635ed2391cc 100644 |
| --- a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc |
| +++ b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc |
| @@ -7,7 +7,10 @@ |
| #include "base/bind.h" |
| #include "base/run_loop.h" |
| #include "chrome/test/base/testing_profile.h" |
| +#include "content/public/browser/storage_partition.h" |
| +#include "content/public/common/url_constants.h" |
| #include "content/public/test/test_browser_thread_bundle.h" |
| +#include "content/public/test/test_utils.h" |
| #include "net/cookies/canonical_cookie.h" |
| #include "net/cookies/parsed_cookie.h" |
| #include "net/url_request/url_request_context_getter.h" |
| @@ -21,25 +24,33 @@ class BrowsingDataCookieHelperTest : public testing::Test { |
| : testing_profile_(new TestingProfile()) { |
| } |
| + net::CookieMonster* GetCookieMonster(const GURL& origin) { |
| + using content::BrowserContext; |
|
Bernhard Bauer
2013/08/16 06:46:44
This isn't very... commonly seen in Chrome code. A
awong
2013/08/17 00:32:52
Since no one else was using it, didn't see a reaso
|
| + // Since it's a unittest, assume default StoragePartition. |
| + return content::GetCookieStoreForScheme( |
| + BrowserContext::GetDefaultStoragePartition(testing_profile_.get()), |
| + origin.scheme())->GetCookieMonster(); |
| + } |
| + |
| void CreateCookiesForTest() { |
| - scoped_refptr<net::CookieMonster> cookie_monster = |
| - testing_profile_->GetCookieMonster(); |
| - cookie_monster->SetCookieWithOptionsAsync( |
| - GURL("http://www.google.com"), "A=1", net::CookieOptions(), |
| + GURL origin1("http://www.google.com"); |
| + GURL origin2("http://www.gmail.google.com"); |
| + GetCookieMonster(origin1)->SetCookieWithOptionsAsync( |
| + origin1, "A=1", net::CookieOptions(), |
| net::CookieMonster::SetCookiesCallback()); |
| - cookie_monster->SetCookieWithOptionsAsync( |
| - GURL("http://www.gmail.google.com"), "B=1", net::CookieOptions(), |
| + GetCookieMonster(origin2)->SetCookieWithOptionsAsync( |
| + origin2, "B=1", net::CookieOptions(), |
| net::CookieMonster::SetCookiesCallback()); |
| } |
| void CreateCookiesForDomainCookieTest() { |
| - scoped_refptr<net::CookieMonster> cookie_monster = |
| - testing_profile_->GetCookieMonster(); |
| + GURL origin("http://www.google.com"); |
| + scoped_refptr<net::CookieMonster> cookie_monster = GetCookieMonster(origin); |
| cookie_monster->SetCookieWithOptionsAsync( |
| - GURL("http://www.google.com"), "A=1", net::CookieOptions(), |
| + origin, "A=1", net::CookieOptions(), |
| net::CookieMonster::SetCookiesCallback()); |
| cookie_monster->SetCookieWithOptionsAsync( |
| - GURL("http://www.google.com"), "A=2; Domain=.www.google.com ", |
| + origin, "A=2; Domain=.www.google.com ", |
| net::CookieOptions(), net::CookieMonster::SetCookiesCallback()); |
| } |