| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_pool.h" | 5 #include "net/spdy/spdy_session_pool.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 "js.foo.com", | 334 "js.foo.com", |
| 335 "192.168.0.2,192.168.0.3,192.168.0.5,192.0.2.33" | 335 "192.168.0.2,192.168.0.3,192.168.0.5,192.0.2.33" |
| 336 }, | 336 }, |
| 337 { "http://images.foo.com", | 337 { "http://images.foo.com", |
| 338 "images.foo.com", | 338 "images.foo.com", |
| 339 "192.168.0.4,192.168.0.3" | 339 "192.168.0.4,192.168.0.3" |
| 340 }, | 340 }, |
| 341 }; | 341 }; |
| 342 | 342 |
| 343 session_deps_.host_resolver->set_synchronous_mode(true); | 343 session_deps_.host_resolver->set_synchronous_mode(true); |
| 344 std::unique_ptr<HostResolver::Request> request[arraysize(test_hosts)]; |
| 344 for (size_t i = 0; i < arraysize(test_hosts); i++) { | 345 for (size_t i = 0; i < arraysize(test_hosts); i++) { |
| 345 session_deps_.host_resolver->rules()->AddIPLiteralRule( | 346 session_deps_.host_resolver->rules()->AddIPLiteralRule( |
| 346 test_hosts[i].name, test_hosts[i].iplist, std::string()); | 347 test_hosts[i].name, test_hosts[i].iplist, std::string()); |
| 347 | 348 |
| 348 // This test requires that the HostResolver cache be populated. Normal | 349 // This test requires that the HostResolver cache be populated. Normal |
| 349 // code would have done this already, but we do it manually. | 350 // code would have done this already, but we do it manually. |
| 350 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); | 351 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); |
| 351 session_deps_.host_resolver->Resolve(info, | 352 session_deps_.host_resolver->Resolve( |
| 352 DEFAULT_PRIORITY, | 353 info, DEFAULT_PRIORITY, &test_hosts[i].addresses, CompletionCallback(), |
| 353 &test_hosts[i].addresses, | 354 &request[i], BoundNetLog()); |
| 354 CompletionCallback(), | |
| 355 NULL, | |
| 356 BoundNetLog()); | |
| 357 | 355 |
| 358 // Setup a SpdySessionKey | 356 // Setup a SpdySessionKey |
| 359 test_hosts[i].key = SpdySessionKey( | 357 test_hosts[i].key = SpdySessionKey( |
| 360 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), | 358 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), |
| 361 PRIVACY_MODE_DISABLED); | 359 PRIVACY_MODE_DISABLED); |
| 362 } | 360 } |
| 363 | 361 |
| 364 MockConnect connect_data(SYNCHRONOUS, OK); | 362 MockConnect connect_data(SYNCHRONOUS, OK); |
| 365 MockRead reads[] = { | 363 MockRead reads[] = { |
| 366 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. | 364 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 // there is no pushed stream on any sessions owned by |spdy_session_pool_|. | 656 // there is no pushed stream on any sessions owned by |spdy_session_pool_|. |
| 659 base::WeakPtr<SpdySession> session2 = | 657 base::WeakPtr<SpdySession> session2 = |
| 660 spdy_session_pool_->FindAvailableSession( | 658 spdy_session_pool_->FindAvailableSession( |
| 661 key, GURL("http://news.example.org/foo.html"), BoundNetLog()); | 659 key, GURL("http://news.example.org/foo.html"), BoundNetLog()); |
| 662 EXPECT_EQ(session.get(), session2.get()); | 660 EXPECT_EQ(session.get(), session2.get()); |
| 663 | 661 |
| 664 spdy_session_pool_->CloseCurrentSessions(ERR_ABORTED); | 662 spdy_session_pool_->CloseCurrentSessions(ERR_ABORTED); |
| 665 } | 663 } |
| 666 | 664 |
| 667 } // namespace net | 665 } // namespace net |
| OLD | NEW |