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

Side by Side Diff: net/spdy/spdy_session_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: mmenke's comments and rebasing Created 4 years, 5 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) 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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 3039 matching lines...) Expand 10 before | Expand all | Expand 10 after
3050 PRIVACY_MODE_DISABLED); 3050 PRIVACY_MODE_DISABLED);
3051 base::WeakPtr<SpdySession> session1 = ::net::CreateInsecureSpdySession( 3051 base::WeakPtr<SpdySession> session1 = ::net::CreateInsecureSpdySession(
3052 http_session_.get(), key1, BoundNetLog()); 3052 http_session_.get(), key1, BoundNetLog());
3053 EXPECT_FALSE(pool->IsStalled()); 3053 EXPECT_FALSE(pool->IsStalled());
3054 3054
3055 // Set up an alias for the idle SPDY session, increasing its ref count to 2. 3055 // Set up an alias for the idle SPDY session, increasing its ref count to 2.
3056 SpdySessionKey key2(HostPortPair("2.com", 80), ProxyServer::Direct(), 3056 SpdySessionKey key2(HostPortPair("2.com", 80), ProxyServer::Direct(),
3057 PRIVACY_MODE_DISABLED); 3057 PRIVACY_MODE_DISABLED);
3058 HostResolver::RequestInfo info(key2.host_port_pair()); 3058 HostResolver::RequestInfo info(key2.host_port_pair());
3059 AddressList addresses; 3059 AddressList addresses;
3060 std::unique_ptr<HostResolver::Request> request;
3060 // Pre-populate the DNS cache, since a synchronous resolution is required in 3061 // Pre-populate the DNS cache, since a synchronous resolution is required in
3061 // order to create the alias. 3062 // order to create the alias.
3062 session_deps_.host_resolver->Resolve(info, DEFAULT_PRIORITY, &addresses, 3063 session_deps_.host_resolver->Resolve(info, DEFAULT_PRIORITY, &addresses,
3063 CompletionCallback(), nullptr, 3064 CompletionCallback(), &request,
3064 BoundNetLog()); 3065 BoundNetLog());
3065 // Get a session for |key2|, which should return the session created earlier. 3066 // Get a session for |key2|, which should return the session created earlier.
3066 base::WeakPtr<SpdySession> session2 = 3067 base::WeakPtr<SpdySession> session2 =
3067 spdy_session_pool_->FindAvailableSession(key2, GURL(), BoundNetLog()); 3068 spdy_session_pool_->FindAvailableSession(key2, GURL(), BoundNetLog());
3068 ASSERT_EQ(session1.get(), session2.get()); 3069 ASSERT_EQ(session1.get(), session2.get());
3069 EXPECT_FALSE(pool->IsStalled()); 3070 EXPECT_FALSE(pool->IsStalled());
3070 3071
3071 // Trying to create a new connection should cause the pool to be stalled, and 3072 // Trying to create a new connection should cause the pool to be stalled, and
3072 // post a task asynchronously to try and close the session. 3073 // post a task asynchronously to try and close the session.
3073 TestCompletionCallback callback3; 3074 TestCompletionCallback callback3;
(...skipping 2471 matching lines...) Expand 10 before | Expand all | Expand 10 after
5545 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), 5546 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(),
5546 "spdy_pooling.pem"); 5547 "spdy_pooling.pem");
5547 ssl_info.is_issued_by_known_root = true; 5548 ssl_info.is_issued_by_known_root = true;
5548 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); 5549 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin));
5549 5550
5550 EXPECT_TRUE(SpdySession::CanPool( 5551 EXPECT_TRUE(SpdySession::CanPool(
5551 &tss, ssl_info, "www.example.org", "mail.example.org")); 5552 &tss, ssl_info, "www.example.org", "mail.example.org"));
5552 } 5553 }
5553 5554
5554 } // namespace net 5555 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698