diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-31 08:14:09 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-31 08:14:09 +0000 |
commit | b281b6c0ffcafa4d54737315793db39105bddb6a (patch) | |
tree | 62ffb267d160e3564f46e5aca865bd17f1fb15dc /chrome/browser/net/cookie_policy_browsertest.cc | |
parent | 9c17fa9a47b94c2875a203114511e7a679c65060 (diff) | |
download | chromium_src-b281b6c0ffcafa4d54737315793db39105bddb6a.zip chromium_src-b281b6c0ffcafa4d54737315793db39105bddb6a.tar.gz chromium_src-b281b6c0ffcafa4d54737315793db39105bddb6a.tar.bz2 |
Re-enable the cookie policy browser tests.
This is a simple change to replace the old preference-using code w/
code that just pokes the HostContentSettingsMap directly to toggle
the third-party cookie blocking setting.
R=pkasting
Review URL: http://codereview.chromium.org/548218
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37659 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/cookie_policy_browsertest.cc')
-rw-r--r-- | chrome/browser/net/cookie_policy_browsertest.cc | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/chrome/browser/net/cookie_policy_browsertest.cc b/chrome/browser/net/cookie_policy_browsertest.cc index e4683ff..923f4c5 100644 --- a/chrome/browser/net/cookie_policy_browsertest.cc +++ b/chrome/browser/net/cookie_policy_browsertest.cc @@ -3,10 +3,9 @@ // found in the LICENSE file. #include "chrome/browser/browser.h" +#include "chrome/browser/host_content_settings_map.h" #include "chrome/browser/net/url_request_context_getter.h" #include "chrome/browser/profile.h" -#include "chrome/common/pref_names.h" -#include "chrome/common/pref_service.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "net/base/mock_host_resolver.h" @@ -19,20 +18,13 @@ class CookiePolicyBrowserTest : public InProcessBrowserTest { DISALLOW_COPY_AND_ASSIGN(CookiePolicyBrowserTest); }; -// TODO(darin): Re-enable these tests once the new third-party cookie blocking -// preference is hooked up. -#if 0 // Visits a page that sets a first-party cookie. IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest, AllowFirstPartyCookies) { HTTPTestServer* server = StartHTTPServer(); ASSERT_TRUE(server != NULL); - PrefService* prefs = browser()->profile()->GetPrefs(); - prefs->SetInteger(prefs::kCookieBehavior, - net::CookiePolicy::BLOCK_THIRD_PARTY_COOKIES); - net::CookiePolicy::Type policy_type = net::CookiePolicy::FromInt( - prefs->GetInteger(prefs::kCookieBehavior)); - ASSERT_EQ(net::CookiePolicy::BLOCK_THIRD_PARTY_COOKIES, policy_type); + browser()->profile()->GetHostContentSettingsMap()-> + SetBlockThirdPartyCookies(true); net::CookieStore* cookie_store = browser()->profile()->GetRequestContext()->GetCookieStore(); @@ -56,12 +48,8 @@ IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest, HTTPTestServer* server = StartHTTPServer(); ASSERT_TRUE(server != NULL); - PrefService* prefs = browser()->profile()->GetPrefs(); - prefs->SetInteger(prefs::kCookieBehavior, - net::CookiePolicy::BLOCK_THIRD_PARTY_COOKIES); - net::CookiePolicy::Type policy_type = net::CookiePolicy::FromInt( - prefs->GetInteger(prefs::kCookieBehavior)); - ASSERT_EQ(net::CookiePolicy::BLOCK_THIRD_PARTY_COOKIES, policy_type); + browser()->profile()->GetHostContentSettingsMap()-> + SetBlockThirdPartyCookies(true); net::CookieStore* cookie_store = browser()->profile()->GetRequestContext()->GetCookieStore(); @@ -89,4 +77,3 @@ IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest, cookie = cookie_store->GetCookies(redirected_url); EXPECT_EQ("cookie2", cookie); } -#endif |