| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/url_request/url_request_unittest.h" | 5 #include "net/url_request/url_request_unittest.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <shlobj.h> | 10 #include <shlobj.h> |
| (...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") | 1553 EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") |
| 1554 == std::string::npos); | 1554 == std::string::npos); |
| 1555 EXPECT_TRUE(d.data_received().find("CookieToNotUpdate=2") | 1555 EXPECT_TRUE(d.data_received().find("CookieToNotUpdate=2") |
| 1556 != std::string::npos); | 1556 != std::string::npos); |
| 1557 | 1557 |
| 1558 EXPECT_EQ(0, d.blocked_get_cookies_count()); | 1558 EXPECT_EQ(0, d.blocked_get_cookies_count()); |
| 1559 EXPECT_EQ(0, d.blocked_set_cookie_count()); | 1559 EXPECT_EQ(0, d.blocked_set_cookie_count()); |
| 1560 } | 1560 } |
| 1561 } | 1561 } |
| 1562 | 1562 |
| 1563 TEST_F(URLRequestTest, DoNotSaveEmptyCookies) { |
| 1564 net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); |
| 1565 ASSERT_TRUE(test_server.Start()); |
| 1566 |
| 1567 scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); |
| 1568 |
| 1569 // Set up an empty cookie. |
| 1570 { |
| 1571 TestDelegate d; |
| 1572 URLRequest req(test_server.GetURL("set-cookie"), &d); |
| 1573 req.set_context(context); |
| 1574 req.Start(); |
| 1575 MessageLoop::current()->Run(); |
| 1576 |
| 1577 EXPECT_EQ(0, d.blocked_get_cookies_count()); |
| 1578 EXPECT_EQ(0, d.blocked_set_cookie_count()); |
| 1579 EXPECT_EQ(0, d.set_cookie_count()); |
| 1580 } |
| 1581 } |
| 1582 |
| 1563 TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { | 1583 TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { |
| 1564 net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); | 1584 net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); |
| 1565 ASSERT_TRUE(test_server.Start()); | 1585 ASSERT_TRUE(test_server.Start()); |
| 1566 | 1586 |
| 1567 scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); | 1587 scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); |
| 1568 | 1588 |
| 1569 // Set up a cookie. | 1589 // Set up a cookie. |
| 1570 { | 1590 { |
| 1571 TestDelegate d; | 1591 TestDelegate d; |
| 1572 URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); | 1592 URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2680 TestURLRequest | 2700 TestURLRequest |
| 2681 req(test_server_.GetURL("echoheaderoverride?Accept-Charset"), &d); | 2701 req(test_server_.GetURL("echoheaderoverride?Accept-Charset"), &d); |
| 2682 req.set_context(new TestURLRequestContext()); | 2702 req.set_context(new TestURLRequestContext()); |
| 2683 net::HttpRequestHeaders headers; | 2703 net::HttpRequestHeaders headers; |
| 2684 headers.SetHeader(net::HttpRequestHeaders::kAcceptCharset, "koi-8r"); | 2704 headers.SetHeader(net::HttpRequestHeaders::kAcceptCharset, "koi-8r"); |
| 2685 req.SetExtraRequestHeaders(headers); | 2705 req.SetExtraRequestHeaders(headers); |
| 2686 req.Start(); | 2706 req.Start(); |
| 2687 MessageLoop::current()->Run(); | 2707 MessageLoop::current()->Run(); |
| 2688 EXPECT_EQ(std::string("koi-8r"), d.data_received()); | 2708 EXPECT_EQ(std::string("koi-8r"), d.data_received()); |
| 2689 } | 2709 } |
| OLD | NEW |