Commit 61ceb531 authored by mmenke's avatar mmenke Committed by Commit bot

Replace TestingProfile::GetCookieMonster with GetCookieStore.

I'm trying to remove CookieStore::GetCookieMonster, since it's
weird and ugly to have most consumers of a class have hard
dependencies on it being a particular subclass of that class.

Also make a test using the method no longer hold onto references
to the CookieStore, in preparation for de-reference-counting the
class.

BUG=579653

Review URL: https://codereview.chromium.org/1613473002

Cr-Commit-Position: refs/heads/master@{#370779}
parent cbc1e379
......@@ -110,23 +110,21 @@ class BrowsingDataCookieHelperTest : public testing::Test {
}
void CreateCookiesForTest() {
scoped_refptr<net::CookieMonster> cookie_monster =
testing_profile_->GetCookieMonster();
cookie_monster->SetCookieWithOptionsAsync(
net::CookieStore* cookie_store = testing_profile_->GetCookieStore();
cookie_store->SetCookieWithOptionsAsync(
GURL("http://www.google.com"), "A=1", net::CookieOptions(),
net::CookieMonster::SetCookiesCallback());
cookie_monster->SetCookieWithOptionsAsync(
cookie_store->SetCookieWithOptionsAsync(
GURL("http://www.gmail.google.com"), "B=1", net::CookieOptions(),
net::CookieMonster::SetCookiesCallback());
}
void CreateCookiesForDomainCookieTest() {
scoped_refptr<net::CookieMonster> cookie_monster =
testing_profile_->GetCookieMonster();
cookie_monster->SetCookieWithOptionsAsync(
net::CookieStore* cookie_store = testing_profile_->GetCookieStore();
cookie_store->SetCookieWithOptionsAsync(
GURL("http://www.google.com"), "A=1", net::CookieOptions(),
net::CookieMonster::SetCookiesCallback());
cookie_monster->SetCookieWithOptionsAsync(
cookie_store->SetCookieWithOptionsAsync(
GURL("http://www.google.com"), "A=2; Domain=.www.google.com ",
net::CookieOptions(), net::CookieMonster::SetCookiesCallback());
}
......
......@@ -733,11 +733,10 @@ TestingProfile::GetExtensionSpecialStoragePolicy() {
#endif
}
net::CookieMonster* TestingProfile::GetCookieMonster() {
net::CookieStore* TestingProfile::GetCookieStore() {
if (!GetRequestContext())
return NULL;
return GetRequestContext()->GetURLRequestContext()->cookie_store()->
GetCookieMonster();
return GetRequestContext()->GetURLRequestContext()->cookie_store();
}
void TestingProfile::CreateTestingPrefService() {
......
......@@ -29,7 +29,7 @@ class ZoomLevelDelegate;
}
namespace net {
class CookieMonster;
class CookieStore;
class URLRequestContextGetter;
}
......@@ -269,7 +269,7 @@ class TestingProfile : public Profile {
// TODO(ajwong): Remove this API in favor of directly retrieving the
// CookieStore from the StoragePartition after ExtensionURLRequestContext
// has been removed.
net::CookieMonster* GetCookieMonster();
net::CookieStore* GetCookieStore();
PrefService* GetPrefs() override;
const PrefService* GetPrefs() const override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment