| Index: net/url_request/url_request_unittest.cc
|
| diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
|
| index c4958a962e3436a223867414d36fd0d33d96887c..662b615089bac78cc09cea16c7ded512667c67ac 100644
|
| --- a/net/url_request/url_request_unittest.cc
|
| +++ b/net/url_request/url_request_unittest.cc
|
| @@ -1663,8 +1663,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) {
|
|
|
| // Verify that the cookie isn't sent.
|
| {
|
| - TestCookiePolicy cookie_policy(TestCookiePolicy::NO_GET_COOKIES |
|
| - TestCookiePolicy::ASYNC);
|
| + TestCookiePolicy cookie_policy(TestCookiePolicy::NO_GET_COOKIES);
|
| context->set_cookie_policy(&cookie_policy);
|
|
|
| TestDelegate d;
|
| @@ -1704,8 +1703,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) {
|
|
|
| // Try to set-up another cookie and update the previous cookie.
|
| {
|
| - TestCookiePolicy cookie_policy(TestCookiePolicy::NO_SET_COOKIE |
|
| - TestCookiePolicy::ASYNC);
|
| + TestCookiePolicy cookie_policy(TestCookiePolicy::NO_SET_COOKIE);
|
| context->set_cookie_policy(&cookie_policy);
|
|
|
| TestDelegate d;
|
| @@ -1740,100 +1738,6 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) {
|
| }
|
| }
|
|
|
| -TEST_F(URLRequestTest, CancelTest_During_CookiePolicy) {
|
| - TestServer test_server(TestServer::TYPE_HTTP, FilePath());
|
| - ASSERT_TRUE(test_server.Start());
|
| -
|
| - scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
|
| -
|
| - TestCookiePolicy cookie_policy(TestCookiePolicy::ASYNC);
|
| - context->set_cookie_policy(&cookie_policy);
|
| -
|
| - // Set up a cookie.
|
| - {
|
| - TestDelegate d;
|
| - URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"),
|
| - &d);
|
| - req.set_context(context);
|
| - req.Start(); // Triggers an asynchronous cookie policy check.
|
| -
|
| - // But, now we cancel the request by letting it go out of scope. This
|
| - // should not cause a crash.
|
| -
|
| - EXPECT_EQ(0, d.blocked_get_cookies_count());
|
| - EXPECT_EQ(0, d.blocked_set_cookie_count());
|
| - }
|
| -
|
| - context->set_cookie_policy(NULL);
|
| -
|
| - // Let the cookie policy complete. Make sure it handles the destruction of
|
| - // the URLRequest properly.
|
| - MessageLoop::current()->RunAllPending();
|
| -}
|
| -
|
| -TEST_F(URLRequestTest, CancelTest_During_OnGetCookies) {
|
| - TestServer test_server(TestServer::TYPE_HTTP, FilePath());
|
| - ASSERT_TRUE(test_server.Start());
|
| -
|
| - scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
|
| -
|
| - TestCookiePolicy cookie_policy(TestCookiePolicy::NO_GET_COOKIES);
|
| - context->set_cookie_policy(&cookie_policy);
|
| -
|
| - // Set up a cookie.
|
| - {
|
| - TestDelegate d;
|
| - d.set_cancel_in_get_cookies_blocked(true);
|
| - URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"),
|
| - &d);
|
| - req.set_context(context);
|
| - req.Start(); // Triggers an asynchronous cookie policy check.
|
| -
|
| - MessageLoop::current()->Run();
|
| -
|
| - EXPECT_EQ(URLRequestStatus::CANCELED, req.status().status());
|
| -
|
| - EXPECT_EQ(1, d.blocked_get_cookies_count());
|
| - EXPECT_EQ(0, d.blocked_set_cookie_count());
|
| - }
|
| -
|
| - context->set_cookie_policy(NULL);
|
| -}
|
| -
|
| -TEST_F(URLRequestTest, CancelTest_During_OnSetCookie) {
|
| - TestServer test_server(TestServer::TYPE_HTTP, FilePath());
|
| - ASSERT_TRUE(test_server.Start());
|
| -
|
| - scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
|
| -
|
| - TestCookiePolicy cookie_policy(TestCookiePolicy::NO_SET_COOKIE);
|
| - context->set_cookie_policy(&cookie_policy);
|
| -
|
| - // Set up a cookie.
|
| - {
|
| - TestDelegate d;
|
| - d.set_cancel_in_set_cookie_blocked(true);
|
| - URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"),
|
| - &d);
|
| - req.set_context(context);
|
| - req.Start(); // Triggers an asynchronous cookie policy check.
|
| -
|
| - MessageLoop::current()->Run();
|
| -
|
| - EXPECT_EQ(URLRequestStatus::CANCELED, req.status().status());
|
| -
|
| - // Even though the response will contain 3 set-cookie headers, we expect
|
| - // only one to be blocked as that first one will cause OnSetCookie to be
|
| - // called, which will cancel the request. Once canceled, it should not
|
| - // attempt to set further cookies.
|
| -
|
| - EXPECT_EQ(0, d.blocked_get_cookies_count());
|
| - EXPECT_EQ(1, d.blocked_set_cookie_count());
|
| - }
|
| -
|
| - context->set_cookie_policy(NULL);
|
| -}
|
| -
|
| TEST_F(URLRequestTest, CookiePolicy_ForceSession) {
|
| TestServer test_server(TestServer::TYPE_HTTP, FilePath());
|
| ASSERT_TRUE(test_server.Start());
|
|
|