| 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 "net/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
| 6 | 6 |
| 7 #include "net/base/host_cache.h" | 7 #include "net/base/host_cache.h" |
| 8 #include "net/base/ip_endpoint.h" | 8 #include "net/base/ip_endpoint.h" |
| 9 #include "net/base/net_log_unittest.h" | 9 #include "net/base/net_log_unittest.h" |
| 10 #include "net/base/request_priority.h" | 10 #include "net/base/request_priority.h" |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 }, | 697 }, |
| 698 { "http://images.foo.com", | 698 { "http://images.foo.com", |
| 699 "images.foo.com", | 699 "images.foo.com", |
| 700 "192.168.0.4,192.168.0.3" | 700 "192.168.0.4,192.168.0.3" |
| 701 }, | 701 }, |
| 702 }; | 702 }; |
| 703 | 703 |
| 704 SpdySessionDependencies session_deps; | 704 SpdySessionDependencies session_deps; |
| 705 session_deps.host_resolver->set_synchronous_mode(true); | 705 session_deps.host_resolver->set_synchronous_mode(true); |
| 706 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_hosts); i++) { | 706 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_hosts); i++) { |
| 707 session_deps.host_resolver->rules()->AddIPLiteralRule(test_hosts[i].name, | 707 session_deps.host_resolver->rules()->AddIPLiteralRule( |
| 708 test_hosts[i].iplist, ""); | 708 test_hosts[i].name, test_hosts[i].iplist, std::string()); |
| 709 | 709 |
| 710 // This test requires that the HostResolver cache be populated. Normal | 710 // This test requires that the HostResolver cache be populated. Normal |
| 711 // code would have done this already, but we do it manually. | 711 // code would have done this already, but we do it manually. |
| 712 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); | 712 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); |
| 713 session_deps.host_resolver->Resolve( | 713 session_deps.host_resolver->Resolve( |
| 714 info, &test_hosts[i].addresses, CompletionCallback(), NULL, | 714 info, &test_hosts[i].addresses, CompletionCallback(), NULL, |
| 715 BoundNetLog()); | 715 BoundNetLog()); |
| 716 | 716 |
| 717 // Setup a HostPortProxyPair | 717 // Setup a HostPortProxyPair |
| 718 test_hosts[i].pair = HostPortProxyPair( | 718 test_hosts[i].pair = HostPortProxyPair( |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 spdy_stream2->SetDelegate(&delegate2); | 1133 spdy_stream2->SetDelegate(&delegate2); |
| 1134 | 1134 |
| 1135 spdy_stream1->SendRequest(false); | 1135 spdy_stream1->SendRequest(false); |
| 1136 spdy_stream2->SendRequest(false); | 1136 spdy_stream2->SendRequest(false); |
| 1137 | 1137 |
| 1138 // Ensure that the streams have not yet been activated and assigned an id. | 1138 // Ensure that the streams have not yet been activated and assigned an id. |
| 1139 EXPECT_EQ(0u, spdy_stream1->stream_id()); | 1139 EXPECT_EQ(0u, spdy_stream1->stream_id()); |
| 1140 EXPECT_EQ(0u, spdy_stream2->stream_id()); | 1140 EXPECT_EQ(0u, spdy_stream2->stream_id()); |
| 1141 | 1141 |
| 1142 // Ensure we don't crash while closing the session. | 1142 // Ensure we don't crash while closing the session. |
| 1143 session->CloseSessionOnError(ERR_ABORTED, true, ""); | 1143 session->CloseSessionOnError(ERR_ABORTED, true, std::string()); |
| 1144 | 1144 |
| 1145 EXPECT_TRUE(spdy_stream1->closed()); | 1145 EXPECT_TRUE(spdy_stream1->closed()); |
| 1146 EXPECT_TRUE(spdy_stream2->closed()); | 1146 EXPECT_TRUE(spdy_stream2->closed()); |
| 1147 | 1147 |
| 1148 spdy_stream1 = NULL; | 1148 spdy_stream1 = NULL; |
| 1149 spdy_stream2 = NULL; | 1149 spdy_stream2 = NULL; |
| 1150 } | 1150 } |
| 1151 | 1151 |
| 1152 TEST_F(SpdySessionSpdy3Test, VerifyDomainAuthentication) { | 1152 TEST_F(SpdySessionSpdy3Test, VerifyDomainAuthentication) { |
| 1153 session_deps_.host_resolver->set_synchronous_mode(true); | 1153 session_deps_.host_resolver->set_synchronous_mode(true); |
| (...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2590 EXPECT_EQ(0, delegate1.body_data_sent()); | 2590 EXPECT_EQ(0, delegate1.body_data_sent()); |
| 2591 | 2591 |
| 2592 EXPECT_TRUE(delegate2.send_headers_completed()); | 2592 EXPECT_TRUE(delegate2.send_headers_completed()); |
| 2593 EXPECT_EQ("200", delegate2.GetResponseHeaderValue(":status")); | 2593 EXPECT_EQ("200", delegate2.GetResponseHeaderValue(":status")); |
| 2594 EXPECT_EQ("HTTP/1.1", delegate2.GetResponseHeaderValue(":version")); | 2594 EXPECT_EQ("HTTP/1.1", delegate2.GetResponseHeaderValue(":version")); |
| 2595 EXPECT_EQ("", delegate2.received_data()); | 2595 EXPECT_EQ("", delegate2.received_data()); |
| 2596 EXPECT_EQ(0, delegate2.body_data_sent()); | 2596 EXPECT_EQ(0, delegate2.body_data_sent()); |
| 2597 } | 2597 } |
| 2598 | 2598 |
| 2599 } // namespace net | 2599 } // namespace net |
| OLD | NEW |