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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 6995013: More progress towards removing content settings code from the content layer. We can't use Cookie... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments and sync Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request_test_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_unittest.cc
===================================================================
--- net/url_request/url_request_unittest.cc (revision 84789)
+++ net/url_request/url_request_unittest.cc (working copy)
@@ -1655,10 +1655,8 @@
// Verify that the cookie isn't sent.
{
- TestCookiePolicy cookie_policy(TestCookiePolicy::NO_GET_COOKIES);
- context->set_cookie_policy(&cookie_policy);
-
TestDelegate d;
+ d.set_cookie_options(TestDelegate::NO_GET_COOKIES);
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d);
req.set_context(context);
req.Start();
@@ -1667,8 +1665,6 @@
EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1")
== std::string::npos);
- context->set_cookie_policy(NULL);
-
EXPECT_EQ(1, d.blocked_get_cookies_count());
EXPECT_EQ(0, d.blocked_set_cookie_count());
}
@@ -1695,10 +1691,8 @@
// Try to set-up another cookie and update the previous cookie.
{
- TestCookiePolicy cookie_policy(TestCookiePolicy::NO_SET_COOKIE);
- context->set_cookie_policy(&cookie_policy);
-
TestDelegate d;
+ d.set_cookie_options(TestDelegate::NO_SET_COOKIE);
URLRequest req(test_server.GetURL(
"set-cookie?CookieToNotSave=1&CookieToNotUpdate=1"), &d);
req.set_context(context);
@@ -1706,8 +1700,6 @@
MessageLoop::current()->Run();
- context->set_cookie_policy(NULL);
-
EXPECT_EQ(0, d.blocked_get_cookies_count());
EXPECT_EQ(2, d.blocked_set_cookie_count());
}
@@ -1786,10 +1778,8 @@
// Verify that the cookie isn't sent.
{
- TestCookiePolicy cookie_policy(TestCookiePolicy::NO_GET_COOKIES);
- context->set_cookie_policy(&cookie_policy);
-
TestDelegate d;
+ d.set_cookie_options(TestDelegate::NO_GET_COOKIES);
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d);
req.set_context(context);
req.Start();
@@ -1798,8 +1788,6 @@
EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1")
== std::string::npos);
- context->set_cookie_policy(NULL);
-
EXPECT_EQ(1, d.blocked_get_cookies_count());
EXPECT_EQ(0, d.blocked_set_cookie_count());
}
@@ -1826,10 +1814,8 @@
// Try to set-up another cookie and update the previous cookie.
{
- TestCookiePolicy cookie_policy(TestCookiePolicy::NO_SET_COOKIE);
- context->set_cookie_policy(&cookie_policy);
-
TestDelegate d;
+ d.set_cookie_options(TestDelegate::NO_SET_COOKIE);
URLRequest req(test_server.GetURL(
"set-cookie?CookieToNotSave=1&CookieToNotUpdate=1"), &d);
req.set_context(context);
@@ -1837,8 +1823,6 @@
MessageLoop::current()->Run();
- context->set_cookie_policy(NULL);
-
EXPECT_EQ(0, d.blocked_get_cookies_count());
EXPECT_EQ(2, d.blocked_set_cookie_count());
}
@@ -1867,12 +1851,10 @@
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
- TestCookiePolicy cookie_policy(TestCookiePolicy::FORCE_SESSION);
- context->set_cookie_policy(&cookie_policy);
-
// Set up a cookie.
{
TestDelegate d;
+ d.set_cookie_options(TestDelegate::FORCE_SESSION);
URLRequest req(test_server.GetURL(
"set-cookie?A=1;expires=\"Fri, 05 Feb 2010 23:42:01 GMT\""), &d);
req.set_context(context);
@@ -1889,8 +1871,6 @@
context->cookie_store()->GetCookieMonster()->GetAllCookies();
EXPECT_EQ(1U, cookies.size());
EXPECT_FALSE(cookies[0].IsPersistent());
-
- context->set_cookie_policy(NULL);
}
// In this test, we do a POST which the server will 302 redirect.
« no previous file with comments | « net/url_request/url_request_test_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698