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

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

Issue 2334623003: Store net::ProxyServer in HttpResponseInfo object (Closed)
Patch Set: Rebased, fix compile error Created 4 years, 2 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
« no previous file with comments | « net/http/http_response_info.h ('k') | net/url_request/url_request.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get()); 538 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
539 HeadersHandler headers_handler; 539 HeadersHandler headers_handler;
540 trans.SetBeforeHeadersSentCallback( 540 trans.SetBeforeHeadersSentCallback(
541 base::Bind(&HeadersHandler::OnBeforeHeadersSent, 541 base::Bind(&HeadersHandler::OnBeforeHeadersSent,
542 base::Unretained(&headers_handler))); 542 base::Unretained(&headers_handler)));
543 RunTransaction(&trans); 543 RunTransaction(&trans);
544 CheckWasHttpResponse(&trans); 544 CheckWasHttpResponse(&trans);
545 CheckResponsePort(&trans, port); 545 CheckResponsePort(&trans, port);
546 CheckResponseData(&trans, expected); 546 CheckResponseData(&trans, expected);
547 EXPECT_EQ(used_proxy, headers_handler.was_proxied()); 547 EXPECT_EQ(used_proxy, headers_handler.was_proxied());
548 if (used_proxy) {
549 EXPECT_TRUE(trans.GetResponseInfo()->proxy_server.is_https());
550 } else {
551 EXPECT_TRUE(trans.GetResponseInfo()->proxy_server.is_direct());
552 }
548 } 553 }
549 554
550 void SendRequestAndExpectQuicResponse(const std::string& expected) { 555 void SendRequestAndExpectQuicResponse(const std::string& expected) {
551 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, false, 443); 556 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, false, 443);
552 } 557 }
553 558
554 void SendRequestAndExpectQuicResponseFromProxyOnPort( 559 void SendRequestAndExpectQuicResponseFromProxyOnPort(
555 const std::string& expected, 560 const std::string& expected,
556 uint16_t port) { 561 uint16_t port) {
557 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, true, port); 562 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, true, port);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get()); 709 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
705 HeadersHandler headers_handler; 710 HeadersHandler headers_handler;
706 trans.SetBeforeHeadersSentCallback( 711 trans.SetBeforeHeadersSentCallback(
707 base::Bind(&HeadersHandler::OnBeforeHeadersSent, 712 base::Bind(&HeadersHandler::OnBeforeHeadersSent,
708 base::Unretained(&headers_handler))); 713 base::Unretained(&headers_handler)));
709 RunTransaction(&trans); 714 RunTransaction(&trans);
710 CheckWasQuicResponse(&trans); 715 CheckWasQuicResponse(&trans);
711 CheckResponsePort(&trans, port); 716 CheckResponsePort(&trans, port);
712 CheckResponseData(&trans, expected); 717 CheckResponseData(&trans, expected);
713 EXPECT_EQ(used_proxy, headers_handler.was_proxied()); 718 EXPECT_EQ(used_proxy, headers_handler.was_proxied());
719 if (used_proxy) {
720 EXPECT_TRUE(trans.GetResponseInfo()->proxy_server.is_quic());
721 } else {
722 EXPECT_TRUE(trans.GetResponseInfo()->proxy_server.is_direct());
723 }
714 } 724 }
715 }; 725 };
716 726
717 INSTANTIATE_TEST_CASE_P(Version, 727 INSTANTIATE_TEST_CASE_P(Version,
718 QuicNetworkTransactionTest, 728 QuicNetworkTransactionTest,
719 ::testing::ValuesIn(AllSupportedVersions())); 729 ::testing::ValuesIn(AllSupportedVersions()));
720 730
721 TEST_P(QuicNetworkTransactionTest, ForceQuic) { 731 TEST_P(QuicNetworkTransactionTest, ForceQuic) {
722 params_.origins_to_force_quic_on.insert( 732 params_.origins_to_force_quic_on.insert(
723 HostPortPair::FromString("mail.example.org:443")); 733 HostPortPair::FromString("mail.example.org:443"));
(...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after
3264 AddHangingSocketData(); 3274 AddHangingSocketData();
3265 3275
3266 SendRequestAndExpectQuicResponse(origin1_); 3276 SendRequestAndExpectQuicResponse(origin1_);
3267 SendRequestAndExpectQuicResponse(origin2_); 3277 SendRequestAndExpectQuicResponse(origin2_);
3268 3278
3269 EXPECT_TRUE(AllDataConsumed()); 3279 EXPECT_TRUE(AllDataConsumed());
3270 } 3280 }
3271 3281
3272 } // namespace test 3282 } // namespace test
3273 } // namespace net 3283 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_info.h ('k') | net/url_request/url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698