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

Unified Diff: net/quic/quic_network_transaction_unittest.cc

Issue 880483004: Treat QUIC proxy as a valid HTTP proxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests to verify callback execution. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_network_transaction.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..50dc57f1b29d67fd9daf8847c8cddaa6408179c8 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_; }
+
+ 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 = false) {
bengr 2015/02/05 00:34:07 Don't use default values
tbansal1 2015/02/05 01:06:45 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(
@@ -414,7 +435,7 @@ TEST_P(QuicNetworkTransactionTest, QuicProxy) {
CreateSession();
- SendRequestAndExpectQuicResponse("hello!");
+ SendRequestAndExpectQuicResponse("hello!", true);
}
TEST_P(QuicNetworkTransactionTest, ForceQuicWithErrorConnecting) {
@@ -1042,3 +1063,4 @@ TEST_P(QuicNetworkTransactionTest, ConnectionCloseDuringConnect) {
} // namespace test
} // namespace net
+
bengr 2015/02/05 00:34:07 Remove the newline
tbansal1 2015/02/05 01:06:45 Done.
« no previous file with comments | « net/http/http_network_transaction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698