Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: net/spdy/spdy_session_pool_unittest.cc

Issue 2116983002: Change HostResolver::Resolve() to take an std::unique_ptr<Request>* rather than a RequestHandle* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: http_stream_factory_impl_job_controller_unittest RequestHandle* to unique_ptr Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698