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

Side by Side Diff: net/quic/quic_network_transaction_unittest.cc

Issue 2109803002: Change a number of SPDY unittests from http to https. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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 <memory> 5 #include <memory>
6 #include <ostream> 6 #include <ostream>
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 HttpAuthHandlerFactory::CreateDefault(&host_resolver_)), 260 HttpAuthHandlerFactory::CreateDefault(&host_resolver_)),
261 random_generator_(0), 261 random_generator_(0),
262 ssl_data_(ASYNC, OK) { 262 ssl_data_(ASYNC, OK) {
263 request_.method = "GET"; 263 request_.method = "GET";
264 std::string url("https://"); 264 std::string url("https://");
265 url.append(kDefaultServerHostName); 265 url.append(kDefaultServerHostName);
266 request_.url = GURL(url); 266 request_.url = GURL(url);
267 request_.load_flags = 0; 267 request_.load_flags = 0;
268 clock_->AdvanceTime(QuicTime::Delta::FromMilliseconds(20)); 268 clock_->AdvanceTime(QuicTime::Delta::FromMilliseconds(20));
269 269
270 params_.enable_alternative_service_for_insecure_origins = true;
271
272 scoped_refptr<X509Certificate> cert( 270 scoped_refptr<X509Certificate> cert(
273 ImportCertFromFile(GetTestCertsDirectory(), "wildcard.pem")); 271 ImportCertFromFile(GetTestCertsDirectory(), "wildcard.pem"));
274 verify_details_.cert_verify_result.verified_cert = cert; 272 verify_details_.cert_verify_result.verified_cert = cert;
275 verify_details_.cert_verify_result.is_issued_by_known_root = true; 273 verify_details_.cert_verify_result.is_issued_by_known_root = true;
276 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details_); 274 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details_);
277 } 275 }
278 276
279 void SetUp() override { 277 void SetUp() override {
280 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); 278 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests();
281 base::RunLoop().RunUntilIdle(); 279 base::RunLoop().RunUntilIdle();
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), 1002 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
1005 MockRead(ASYNC, OK)}; 1003 MockRead(ASYNC, OK)};
1006 1004
1007 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr, 1005 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
1008 0); 1006 0);
1009 1007
1010 socket_factory_.AddSocketDataProvider(&http_data); 1008 socket_factory_.AddSocketDataProvider(&http_data);
1011 socket_factory_.AddSSLSocketDataProvider(&ssl_data_); 1009 socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
1012 1010
1013 CreateSession(); 1011 CreateSession();
1014 // Send http request, ignore alternative service advertising if response 1012 // Send https request, ignore alternative service advertising if response
1015 // header advertises alternative service for mail.example.org. 1013 // header advertises alternative service for mail.example.org.
1016 request_.url = GURL("http://mail.example.org:443"); 1014 request_.url = GURL("https://mail.example.org:443");
1017 SendRequestAndExpectHttpResponse("hello world"); 1015 SendRequestAndExpectHttpResponse("hello world");
1018 HttpServerProperties* http_server_properties = 1016 HttpServerProperties* http_server_properties =
1019 session_->http_server_properties(); 1017 session_->http_server_properties();
1020 url::SchemeHostPort http_server("http", "mail.example.org", 443); 1018 url::SchemeHostPort http_server("http", "mail.example.org", 443);
1021 url::SchemeHostPort https_server("https", "mail.example.org", 443); 1019 url::SchemeHostPort https_server("https", "mail.example.org", 443);
1022 // Check alternative service is set for the correct origin. 1020 // Check alternative service is set for the correct origin.
1023 EXPECT_EQ(2u,
1024 http_server_properties->GetAlternativeServices(http_server).size());
1025 EXPECT_EQ( 1021 EXPECT_EQ(
1026 0u, http_server_properties->GetAlternativeServices(https_server).size()); 1022 2u, http_server_properties->GetAlternativeServices(https_server).size());
1023 EXPECT_TRUE(
1024 http_server_properties->GetAlternativeServices(http_server).empty());
1027 } 1025 }
1028 1026
1029 TEST_P(QuicNetworkTransactionTest, DoNotGetAltSvcForDifferentOrigin) { 1027 TEST_P(QuicNetworkTransactionTest, DoNotGetAltSvcForDifferentOrigin) {
1030 MockRead http_reads[] = { 1028 MockRead http_reads[] = {
1031 MockRead("HTTP/1.1 200 OK\r\n"), 1029 MockRead("HTTP/1.1 200 OK\r\n"),
1032 MockRead("Alt-Svc: quic=\"foo.example.org:443\", quic=\":444\"\r\n\r\n"), 1030 MockRead("Alt-Svc: quic=\"foo.example.org:443\", quic=\":444\"\r\n\r\n"),
1033 MockRead("hello world"), 1031 MockRead("hello world"),
1034 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), 1032 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
1035 MockRead(ASYNC, OK)}; 1033 MockRead(ASYNC, OK)};
1036 1034
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
2663 AddHangingSocketData(); 2661 AddHangingSocketData();
2664 2662
2665 SendRequestAndExpectQuicResponse(origin1_); 2663 SendRequestAndExpectQuicResponse(origin1_);
2666 SendRequestAndExpectQuicResponse(origin2_); 2664 SendRequestAndExpectQuicResponse(origin2_);
2667 2665
2668 EXPECT_TRUE(AllDataConsumed()); 2666 EXPECT_TRUE(AllDataConsumed());
2669 } 2667 }
2670 2668
2671 } // namespace test 2669 } // namespace test
2672 } // namespace net 2670 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_request_unittest.cc ('k') | net/spdy/spdy_http_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698