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

Side by Side Diff: net/http/http_stream_factory_impl_job_controller_unittest.cc

Issue 2886273002: Change GetAlternativeServies to return alternative service infos. (Closed)
Patch Set: address comments in ps #3 Created 3 years, 7 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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/http/http_stream_factory_impl_job_controller.h" 5 #include "net/http/http_stream_factory_impl_job_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 HostPortPair host_port_pair = HostPortPair::FromURL(request_info.url); 248 HostPortPair host_port_pair = HostPortPair::FromURL(request_info.url);
249 url::SchemeHostPort server(request_info.url); 249 url::SchemeHostPort server(request_info.url);
250 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 250 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
251 session_->http_server_properties()->SetAlternativeService( 251 session_->http_server_properties()->SetAlternativeService(
252 server, alternative_service, expiration); 252 server, alternative_service, expiration);
253 } 253 }
254 254
255 void VerifyBrokenAlternateProtocolMapping(const HttpRequestInfo& request_info, 255 void VerifyBrokenAlternateProtocolMapping(const HttpRequestInfo& request_info,
256 bool should_mark_broken) { 256 bool should_mark_broken) {
257 const url::SchemeHostPort server(request_info.url); 257 const url::SchemeHostPort server(request_info.url);
258 const AlternativeServiceVector alternative_service_vector = 258 const AlternativeServiceInfoVector alternative_service_info_vector =
259 session_->http_server_properties()->GetAlternativeServices(server); 259 session_->http_server_properties()->GetAlternativeServiceInfos(server);
260 EXPECT_EQ(1u, alternative_service_vector.size()); 260 EXPECT_EQ(1u, alternative_service_info_vector.size());
261 EXPECT_EQ(should_mark_broken, 261 EXPECT_EQ(should_mark_broken,
262 session_->http_server_properties()->IsAlternativeServiceBroken( 262 session_->http_server_properties()->IsAlternativeServiceBroken(
263 alternative_service_vector[0])); 263 alternative_service_info_vector[0].alternative_service));
264 } 264 }
265 265
266 TestJobFactory job_factory_; 266 TestJobFactory job_factory_;
267 MockHttpStreamRequestDelegate request_delegate_; 267 MockHttpStreamRequestDelegate request_delegate_;
268 SpdySessionDependencies session_deps_; 268 SpdySessionDependencies session_deps_;
269 std::unique_ptr<HttpNetworkSession> session_; 269 std::unique_ptr<HttpNetworkSession> session_;
270 HttpStreamFactoryImpl* factory_; 270 HttpStreamFactoryImpl* factory_;
271 HttpStreamFactoryImpl::JobController* job_controller_; 271 HttpStreamFactoryImpl::JobController* job_controller_;
272 std::unique_ptr<HttpStreamFactoryImpl::Request> request_; 272 std::unique_ptr<HttpStreamFactoryImpl::Request> request_;
273 std::unique_ptr<SequencedSocketData> tcp_data_; 273 std::unique_ptr<SequencedSocketData> tcp_data_;
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 Preconnect(kNumPreconects); 1568 Preconnect(kNumPreconects);
1569 // If experiment is enabled, only 1 stream is requested. 1569 // If experiment is enabled, only 1 stream is requested.
1570 EXPECT_EQ( 1570 EXPECT_EQ(
1571 (int)actual_num_connects, 1571 (int)actual_num_connects,
1572 HttpStreamFactoryImplJobPeer::GetNumStreams(job_controller_->main_job())); 1572 HttpStreamFactoryImplJobPeer::GetNumStreams(job_controller_->main_job()));
1573 base::RunLoop().RunUntilIdle(); 1573 base::RunLoop().RunUntilIdle();
1574 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); 1574 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_));
1575 } 1575 }
1576 1576
1577 } // namespace net 1577 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job_controller.cc ('k') | net/quic/chromium/quic_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698