| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 #endif | 10 #endif |
| (...skipping 4235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4246 MockHostResolver host_resolver; | 4246 MockHostResolver host_resolver; |
| 4247 TestNetworkDelegate network_delegate; // Must outlive URLRequest. | 4247 TestNetworkDelegate network_delegate; // Must outlive URLRequest. |
| 4248 TestURLRequestContext context(true); | 4248 TestURLRequestContext context(true); |
| 4249 context.set_network_delegate(&network_delegate); | 4249 context.set_network_delegate(&network_delegate); |
| 4250 context.set_host_resolver(&host_resolver); | 4250 context.set_host_resolver(&host_resolver); |
| 4251 TransportSecurityState transport_security_state; | 4251 TransportSecurityState transport_security_state; |
| 4252 context.set_transport_security_state(&transport_security_state); | 4252 context.set_transport_security_state(&transport_security_state); |
| 4253 context.Init(); | 4253 context.Init(); |
| 4254 | 4254 |
| 4255 TestDelegate d; | 4255 TestDelegate d; |
| 4256 URLRequest r(GURL(StringPrintf("https://www.google.com:%d", | 4256 URLRequest r(GURL(base::StringPrintf("https://www.google.com:%d", |
| 4257 test_server.host_port_pair().port())), | 4257 test_server.host_port_pair().port())), |
| 4258 &d, | 4258 &d, |
| 4259 &context); | 4259 &context); |
| 4260 | 4260 |
| 4261 r.Start(); | 4261 r.Start(); |
| 4262 EXPECT_TRUE(r.is_pending()); | 4262 EXPECT_TRUE(r.is_pending()); |
| 4263 | 4263 |
| 4264 MessageLoop::current()->Run(); | 4264 MessageLoop::current()->Run(); |
| 4265 | 4265 |
| 4266 EXPECT_EQ(1, d.response_started_count()); | 4266 EXPECT_EQ(1, d.response_started_count()); |
| 4267 EXPECT_FALSE(d.received_data_before_response()); | 4267 EXPECT_FALSE(d.received_data_before_response()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 4293 context.set_network_delegate(&network_delegate); | 4293 context.set_network_delegate(&network_delegate); |
| 4294 context.set_host_resolver(&host_resolver); | 4294 context.set_host_resolver(&host_resolver); |
| 4295 TransportSecurityState transport_security_state; | 4295 TransportSecurityState transport_security_state; |
| 4296 TransportSecurityState::DomainState domain_state; | 4296 TransportSecurityState::DomainState domain_state; |
| 4297 EXPECT_TRUE(transport_security_state.GetDomainState("www.google.com", true, | 4297 EXPECT_TRUE(transport_security_state.GetDomainState("www.google.com", true, |
| 4298 &domain_state)); | 4298 &domain_state)); |
| 4299 context.set_transport_security_state(&transport_security_state); | 4299 context.set_transport_security_state(&transport_security_state); |
| 4300 context.Init(); | 4300 context.Init(); |
| 4301 | 4301 |
| 4302 TestDelegate d; | 4302 TestDelegate d; |
| 4303 URLRequest r(GURL(StringPrintf("https://www.google.com:%d", | 4303 URLRequest r(GURL(base::StringPrintf("https://www.google.com:%d", |
| 4304 test_server.host_port_pair().port())), | 4304 test_server.host_port_pair().port())), |
| 4305 &d, | 4305 &d, |
| 4306 &context); | 4306 &context); |
| 4307 | 4307 |
| 4308 r.Start(); | 4308 r.Start(); |
| 4309 EXPECT_TRUE(r.is_pending()); | 4309 EXPECT_TRUE(r.is_pending()); |
| 4310 | 4310 |
| 4311 MessageLoop::current()->Run(); | 4311 MessageLoop::current()->Run(); |
| 4312 | 4312 |
| 4313 EXPECT_EQ(1, d.response_started_count()); | 4313 EXPECT_EQ(1, d.response_started_count()); |
| 4314 EXPECT_FALSE(d.received_data_before_response()); | 4314 EXPECT_FALSE(d.received_data_before_response()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4359 context.set_host_resolver(&host_resolver); | 4359 context.set_host_resolver(&host_resolver); |
| 4360 context.set_transport_security_state(&transport_security_state); | 4360 context.set_transport_security_state(&transport_security_state); |
| 4361 context.set_network_delegate(&network_delegate); | 4361 context.set_network_delegate(&network_delegate); |
| 4362 context.Init(); | 4362 context.Init(); |
| 4363 | 4363 |
| 4364 TestDelegate d; | 4364 TestDelegate d; |
| 4365 // Navigating to https://www.somewhere.com instead of https://127.0.0.1 will | 4365 // Navigating to https://www.somewhere.com instead of https://127.0.0.1 will |
| 4366 // cause a certificate error. Ignore the error. | 4366 // cause a certificate error. Ignore the error. |
| 4367 d.set_allow_certificate_errors(true); | 4367 d.set_allow_certificate_errors(true); |
| 4368 | 4368 |
| 4369 URLRequest req(GURL(StringPrintf("http://www.somewhere.com:%d/echo", | 4369 URLRequest req(GURL(base::StringPrintf("http://www.somewhere.com:%d/echo", |
| 4370 test_server.host_port_pair().port())), | 4370 test_server.host_port_pair().port())), |
| 4371 &d, | 4371 &d, |
| 4372 &context); | 4372 &context); |
| 4373 req.set_method("POST"); | 4373 req.set_method("POST"); |
| 4374 req.set_upload(make_scoped_ptr(CreateSimpleUploadData(kData))); | 4374 req.set_upload(make_scoped_ptr(CreateSimpleUploadData(kData))); |
| 4375 | 4375 |
| 4376 req.Start(); | 4376 req.Start(); |
| 4377 MessageLoop::current()->Run(); | 4377 MessageLoop::current()->Run(); |
| 4378 | 4378 |
| 4379 EXPECT_EQ("https", req.url().scheme()); | 4379 EXPECT_EQ("https", req.url().scheme()); |
| 4380 EXPECT_EQ("POST", req.method()); | 4380 EXPECT_EQ("POST", req.method()); |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5322 | 5322 |
| 5323 EXPECT_FALSE(r.is_pending()); | 5323 EXPECT_FALSE(r.is_pending()); |
| 5324 EXPECT_EQ(1, d->response_started_count()); | 5324 EXPECT_EQ(1, d->response_started_count()); |
| 5325 EXPECT_FALSE(d->received_data_before_response()); | 5325 EXPECT_FALSE(d->received_data_before_response()); |
| 5326 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 5326 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
| 5327 } | 5327 } |
| 5328 } | 5328 } |
| 5329 #endif // !defined(DISABLE_FTP_SUPPORT) | 5329 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 5330 | 5330 |
| 5331 } // namespace net | 5331 } // namespace net |
| OLD | NEW |