| 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 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 TEST_F(URLRequestTestHTTP, VaryHeader) { | 1085 TEST_F(URLRequestTestHTTP, VaryHeader) { |
| 1086 ASSERT_TRUE(NULL != server_.get()); | 1086 ASSERT_TRUE(NULL != server_.get()); |
| 1087 | 1087 |
| 1088 scoped_refptr<URLRequestContext> context = new URLRequestTestContext(); | 1088 scoped_refptr<URLRequestContext> context = new URLRequestTestContext(); |
| 1089 | 1089 |
| 1090 // populate the cache | 1090 // populate the cache |
| 1091 { | 1091 { |
| 1092 TestDelegate d; | 1092 TestDelegate d; |
| 1093 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); | 1093 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); |
| 1094 req.set_context(context); | 1094 req.set_context(context); |
| 1095 req.SetExtraRequestHeaders("foo: 1"); | 1095 req.SetExtraRequestHeaders("foo:1"); |
| 1096 req.Start(); | 1096 req.Start(); |
| 1097 MessageLoop::current()->Run(); | 1097 MessageLoop::current()->Run(); |
| 1098 } | 1098 } |
| 1099 | 1099 |
| 1100 // expect a cache hit | 1100 // expect a cache hit |
| 1101 { | 1101 { |
| 1102 TestDelegate d; | 1102 TestDelegate d; |
| 1103 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); | 1103 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); |
| 1104 req.set_context(context); | 1104 req.set_context(context); |
| 1105 req.SetExtraRequestHeaders("foo: 1"); | 1105 req.SetExtraRequestHeaders("foo:1"); |
| 1106 req.Start(); | 1106 req.Start(); |
| 1107 MessageLoop::current()->Run(); | 1107 MessageLoop::current()->Run(); |
| 1108 | 1108 |
| 1109 EXPECT_TRUE(req.was_cached()); | 1109 EXPECT_TRUE(req.was_cached()); |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 // expect a cache miss | 1112 // expect a cache miss |
| 1113 { | 1113 { |
| 1114 TestDelegate d; | 1114 TestDelegate d; |
| 1115 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); | 1115 URLRequest req(server_->TestServerPage("echoheader?foo"), &d); |
| 1116 req.set_context(context); | 1116 req.set_context(context); |
| 1117 req.SetExtraRequestHeaders("foo: 2"); | 1117 req.SetExtraRequestHeaders("foo:2"); |
| 1118 req.Start(); | 1118 req.Start(); |
| 1119 MessageLoop::current()->Run(); | 1119 MessageLoop::current()->Run(); |
| 1120 | 1120 |
| 1121 EXPECT_FALSE(req.was_cached()); | 1121 EXPECT_FALSE(req.was_cached()); |
| 1122 } | 1122 } |
| 1123 } | 1123 } |
| 1124 | 1124 |
| 1125 TEST_F(URLRequestTestHTTP, BasicAuth) { | 1125 TEST_F(URLRequestTestHTTP, BasicAuth) { |
| 1126 scoped_refptr<URLRequestContext> context = new URLRequestTestContext(); | 1126 scoped_refptr<URLRequestContext> context = new URLRequestTestContext(); |
| 1127 ASSERT_TRUE(NULL != server_.get()); | 1127 ASSERT_TRUE(NULL != server_.get()); |
| (...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2515 ASSERT_TRUE(NULL != server_.get()); | 2515 ASSERT_TRUE(NULL != server_.get()); |
| 2516 TestDelegate d; | 2516 TestDelegate d; |
| 2517 TestURLRequest | 2517 TestURLRequest |
| 2518 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); | 2518 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); |
| 2519 req.set_context(new URLRequestTestContext()); | 2519 req.set_context(new URLRequestTestContext()); |
| 2520 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); | 2520 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); |
| 2521 req.Start(); | 2521 req.Start(); |
| 2522 MessageLoop::current()->Run(); | 2522 MessageLoop::current()->Run(); |
| 2523 EXPECT_EQ(std::string("koi-8r"), d.data_received()); | 2523 EXPECT_EQ(std::string("koi-8r"), d.data_received()); |
| 2524 } | 2524 } |
| OLD | NEW |