Index: net/quic/quic_network_transaction_unittest.cc |
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc |
index 5219d1e6ccb3cd4190666290039627b5e6316756..910e830369bb4542660012df94958cb8cb22c5d9 100644 |
--- a/net/quic/quic_network_transaction_unittest.cc |
+++ b/net/quic/quic_network_transaction_unittest.cc |
@@ -102,6 +102,21 @@ class MockQuicData { |
scoped_ptr<SocketDataProvider> socket_data_; |
}; |
+class ProxyHeadersHandler { |
+ public: |
+ ProxyHeadersHandler() : was_called_(false) {} |
+ |
+ bool WasCalled() { return was_called_; } |
Ryan Hamilton
2015/02/05 18:43:12
nit: according to the style guide, this should be
tbansal1
2015/02/05 20:11:55
Done.
|
+ |
+ void OnBeforeProxyHeadersSent(const ProxyInfo& proxy_info, |
+ HttpRequestHeaders* request_headers) { |
+ was_called_ = true; |
+ } |
+ |
+ private: |
+ bool was_called_; |
+}; |
+ |
class QuicNetworkTransactionTest |
: public PlatformTest, |
public ::testing::WithParamInterface<QuicVersion> { |
@@ -268,12 +283,18 @@ class QuicNetworkTransactionTest |
CheckResponseData(trans.get(), expected); |
} |
- void SendRequestAndExpectQuicResponse(const std::string& expected) { |
+ void SendRequestAndExpectQuicResponse(const std::string& expected, |
+ bool expect_headers_callback) { |
Ryan Hamilton
2015/02/05 18:43:12
nit: I think this parameter should be named someth
tbansal1
2015/02/05 20:11:55
Done.
|
scoped_ptr<HttpNetworkTransaction> trans( |
new HttpNetworkTransaction(DEFAULT_PRIORITY, session_.get())); |
+ ProxyHeadersHandler proxy_headers_handler; |
+ trans->SetBeforeProxyHeadersSentCallback( |
+ base::Bind(&ProxyHeadersHandler::OnBeforeProxyHeadersSent, |
+ base::Unretained(&proxy_headers_handler))); |
RunTransaction(trans.get()); |
CheckWasQuicResponse(trans); |
CheckResponseData(trans.get(), expected); |
+ EXPECT_TRUE(!expect_headers_callback || proxy_headers_handler.WasCalled()); |
} |
void AddQuicAlternateProtocolMapping( |
@@ -353,7 +374,7 @@ TEST_P(QuicNetworkTransactionTest, ForceQuic) { |
CreateSession(); |
- SendRequestAndExpectQuicResponse("hello!"); |
+ SendRequestAndExpectQuicResponse("hello!", false); |
// Check that the NetLog was filled reasonably. |
net::CapturingNetLog::CapturedEntryList entries; |
@@ -414,7 +435,7 @@ TEST_P(QuicNetworkTransactionTest, QuicProxy) { |
CreateSession(); |
- SendRequestAndExpectQuicResponse("hello!"); |
+ SendRequestAndExpectQuicResponse("hello!", true); |
Ryan Hamilton
2015/02/05 18:43:12
It's not obvious here what true and false refer to
tbansal1
2015/02/05 20:11:55
Done.
|
} |
TEST_P(QuicNetworkTransactionTest, ForceQuicWithErrorConnecting) { |
@@ -492,7 +513,7 @@ TEST_P(QuicNetworkTransactionTest, UseAlternateProtocolForQuic) { |
CreateSessionWithNextProtos(); |
SendRequestAndExpectHttpResponse("hello world"); |
- SendRequestAndExpectQuicResponse("hello!"); |
+ SendRequestAndExpectQuicResponse("hello!", false); |
} |
TEST_P(QuicNetworkTransactionTest, UseAlternateProtocolProbabilityForQuic) { |
@@ -530,7 +551,7 @@ TEST_P(QuicNetworkTransactionTest, UseAlternateProtocolProbabilityForQuic) { |
CreateSessionWithNextProtos(); |
SendRequestAndExpectHttpResponse("hello world"); |
- SendRequestAndExpectQuicResponse("hello!"); |
+ SendRequestAndExpectQuicResponse("hello!", false); |
} |
TEST_P(QuicNetworkTransactionTest, DontUseAlternateProtocolProbabilityForQuic) { |
@@ -695,7 +716,7 @@ TEST_P(QuicNetworkTransactionTest, ZeroRTTWithHttpRace) { |
CreateSessionWithNextProtos(); |
AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
- SendRequestAndExpectQuicResponse("hello!"); |
+ SendRequestAndExpectQuicResponse("hello!", false); |
} |
TEST_P(QuicNetworkTransactionTest, ZeroRTTWithNoHttpRace) { |
@@ -728,7 +749,7 @@ TEST_P(QuicNetworkTransactionTest, ZeroRTTWithNoHttpRace) { |
CreateSessionWithNextProtos(); |
AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
- SendRequestAndExpectQuicResponse("hello!"); |
+ SendRequestAndExpectQuicResponse("hello!", false); |
} |
TEST_P(QuicNetworkTransactionTest, ZeroRTTWithProxy) { |