| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 <windows.h> | 10 #include <windows.h> |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 TEST_F(URLRequestTestHTTP, VaryHeader) { | 1094 TEST_F(URLRequestTestHTTP, VaryHeader) { |
| 1095 ASSERT_TRUE(NULL != server_.get()); | 1095 ASSERT_TRUE(NULL != server_.get()); |
| 1096 | 1096 |
| 1097 scoped_refptr<URLRequestContext> context = new URLRequestTestContext(); | 1097 scoped_refptr<URLRequestContext> context = new URLRequestTestContext(); |
| 1098 | 1098 |
| 1099 // populate the cache | 1099 // populate the cache |
| 1100 { | 1100 { |
| 1101 TestDelegate d; | 1101 TestDelegate d; |
| 1102 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); | 1102 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); |
| 1103 req.set_context(context); | 1103 req.set_context(context); |
| 1104 req.SetExtraRequestHeaders("foo:1"); | 1104 req.SetExtraRequestHeaders("foo: 1"); |
| 1105 req.Start(); | 1105 req.Start(); |
| 1106 MessageLoop::current()->Run(); | 1106 MessageLoop::current()->Run(); |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 // expect a cache hit | 1109 // expect a cache hit |
| 1110 { | 1110 { |
| 1111 TestDelegate d; | 1111 TestDelegate d; |
| 1112 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); | 1112 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); |
| 1113 req.set_context(context); | 1113 req.set_context(context); |
| 1114 req.SetExtraRequestHeaders("foo:1"); | 1114 req.SetExtraRequestHeaders("foo: 1"); |
| 1115 req.Start(); | 1115 req.Start(); |
| 1116 MessageLoop::current()->Run(); | 1116 MessageLoop::current()->Run(); |
| 1117 | 1117 |
| 1118 EXPECT_TRUE(req.was_cached()); | 1118 EXPECT_TRUE(req.was_cached()); |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 // expect a cache miss | 1121 // expect a cache miss |
| 1122 { | 1122 { |
| 1123 TestDelegate d; | 1123 TestDelegate d; |
| 1124 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); | 1124 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); |
| 1125 req.set_context(context); | 1125 req.set_context(context); |
| 1126 req.SetExtraRequestHeaders("foo:2"); | 1126 req.SetExtraRequestHeaders("foo: 2"); |
| 1127 req.Start(); | 1127 req.Start(); |
| 1128 MessageLoop::current()->Run(); | 1128 MessageLoop::current()->Run(); |
| 1129 | 1129 |
| 1130 EXPECT_FALSE(req.was_cached()); | 1130 EXPECT_FALSE(req.was_cached()); |
| 1131 } | 1131 } |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 TEST_F(URLRequestTestHTTP, BasicAuth) { | 1134 TEST_F(URLRequestTestHTTP, BasicAuth) { |
| 1135 scoped_refptr<URLRequestContext> context = new URLRequestTestContext(); | 1135 scoped_refptr<URLRequestContext> context = new URLRequestTestContext(); |
| 1136 ASSERT_TRUE(NULL != server_.get()); | 1136 ASSERT_TRUE(NULL != server_.get()); |
| (...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2524 ASSERT_TRUE(NULL != server_.get()); | 2524 ASSERT_TRUE(NULL != server_.get()); |
| 2525 TestDelegate d; | 2525 TestDelegate d; |
| 2526 TestURLRequest | 2526 TestURLRequest |
| 2527 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); | 2527 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); |
| 2528 req.set_context(new URLRequestTestContext()); | 2528 req.set_context(new URLRequestTestContext()); |
| 2529 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); | 2529 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); |
| 2530 req.Start(); | 2530 req.Start(); |
| 2531 MessageLoop::current()->Run(); | 2531 MessageLoop::current()->Run(); |
| 2532 EXPECT_EQ(std::string("koi-8r"), d.data_received()); | 2532 EXPECT_EQ(std::string("koi-8r"), d.data_received()); |
| 2533 } | 2533 } |
| OLD | NEW |