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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 EXPECT_TRUE(r.is_pending()); | 234 EXPECT_TRUE(r.is_pending()); |
235 | 235 |
236 MessageLoop::current()->Run(); | 236 MessageLoop::current()->Run(); |
237 | 237 |
238 EXPECT_EQ(1, d.response_started_count()); | 238 EXPECT_EQ(1, d.response_started_count()); |
239 EXPECT_FALSE(d.received_data_before_response()); | 239 EXPECT_FALSE(d.received_data_before_response()); |
240 EXPECT_NE(0, d.bytes_received()); | 240 EXPECT_NE(0, d.bytes_received()); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
| 244 TEST_F(URLRequestTestHTTP, HTTPSToHTTPRedirectNoRefererTest) { |
| 245 scoped_refptr<HTTPSTestServer> https_server = |
| 246 HTTPSTestServer::CreateGoodServer(L"net/data/ssl/"); |
| 247 ASSERT_TRUE(NULL != https_server.get()); |
| 248 ASSERT_TRUE(NULL != server_.get()); |
| 249 |
| 250 // An https server is sent a request with an https referer, |
| 251 // and responds with a redirect to an http url. The http |
| 252 // server should not be sent the referer. |
| 253 GURL http_destination = server_->TestServerPage(""); |
| 254 TestDelegate d; |
| 255 TestURLRequest req(https_server->TestServerPage( |
| 256 "server-redirect?" + http_destination.spec()), &d); |
| 257 req.set_referrer("https://www.referrer.com/"); |
| 258 req.Start(); |
| 259 MessageLoop::current()->Run(); |
| 260 |
| 261 EXPECT_EQ(1, d.response_started_count()); |
| 262 EXPECT_EQ(1, d.received_redirect_count()); |
| 263 EXPECT_EQ(http_destination, req.url()); |
| 264 EXPECT_EQ(std::string(), req.referrer()); |
| 265 } |
| 266 |
244 TEST_F(URLRequestTest, QuitTest) { | 267 TEST_F(URLRequestTest, QuitTest) { |
245 // Don't use shared server here because we order it to quit. | 268 // Don't use shared server here because we order it to quit. |
246 // It would impact other tests. | 269 // It would impact other tests. |
247 scoped_refptr<HTTPTestServer> server = | 270 scoped_refptr<HTTPTestServer> server = |
248 HTTPTestServer::CreateServer(L"", NULL); | 271 HTTPTestServer::CreateServer(L"", NULL); |
249 ASSERT_TRUE(NULL != server.get()); | 272 ASSERT_TRUE(NULL != server.get()); |
250 server->SendQuit(); | 273 server->SendQuit(); |
251 EXPECT_TRUE(server->WaitToFinish(20000)); | 274 EXPECT_TRUE(server->WaitToFinish(20000)); |
252 } | 275 } |
253 | 276 |
(...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2220 ASSERT_TRUE(NULL != server_.get()); | 2243 ASSERT_TRUE(NULL != server_.get()); |
2221 TestDelegate d; | 2244 TestDelegate d; |
2222 TestURLRequest | 2245 TestURLRequest |
2223 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); | 2246 req(server_->TestServerPage("echoheaderoverride?Accept-Charset"), &d); |
2224 req.set_context(new URLRequestTestContext()); | 2247 req.set_context(new URLRequestTestContext()); |
2225 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); | 2248 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); |
2226 req.Start(); | 2249 req.Start(); |
2227 MessageLoop::current()->Run(); | 2250 MessageLoop::current()->Run(); |
2228 EXPECT_EQ(std::string("koi-8r"), d.data_received()); | 2251 EXPECT_EQ(std::string("koi-8r"), d.data_received()); |
2229 } | 2252 } |
OLD | NEW |