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

Unified Diff: net/spdy/spdy_network_transaction_unittest.cc

Issue 2140733002: Remove HttpStreamFactory::spdy_enabled_ static member and accessors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop half of this CL. 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 side-by-side diff with in-line comments
Download patch
Index: net/spdy/spdy_network_transaction_unittest.cc
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index 51c632894dcf8e77cfba1a80c5d660262ca4536b..619e4bbf11a5ef67f8fe8a098bf27d480b460e2f 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -130,8 +130,7 @@ class SpdyNetworkTransactionTest : public ::testing::TestWithParam<bool> {
session_(
SpdySessionDependencies::SpdyCreateSession(session_deps_.get())),
log_(log),
- priority_to_dependency_(priority_to_dependency),
- spdy_enabled_(true) {}
+ priority_to_dependency_(priority_to_dependency) {}
~NormalSpdyTransactionHelper() {
// Any test which doesn't close the socket by sending it an EOF will
@@ -145,10 +144,6 @@ class SpdyNetworkTransactionTest : public ::testing::TestWithParam<bool> {
session()->spdy_session_pool()->CloseAllSessions();
}
- void SetSpdyDisabled() {
- spdy_enabled_ = false;
- }
-
void RunPreTestSetup() {
if (!session_deps_.get())
session_deps_ = CreateSpdySessionDependencies(priority_to_dependency_);
@@ -187,25 +182,11 @@ class SpdyNetworkTransactionTest : public ::testing::TestWithParam<bool> {
const HttpResponseInfo* response = trans_->GetResponseInfo();
ASSERT_TRUE(response);
ASSERT_TRUE(response->headers);
- if (HttpStreamFactory::spdy_enabled()) {
- EXPECT_EQ(HttpResponseInfo::ConnectionInfoFromNextProto(kProtoHTTP2),
- response->connection_info);
- } else {
- EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1_1,
- response->connection_info);
- }
- if (spdy_enabled_) {
- EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine());
- EXPECT_TRUE(response->was_fetched_via_spdy);
- EXPECT_TRUE(response->was_npn_negotiated);
- } else {
- EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
- EXPECT_FALSE(response->was_fetched_via_spdy);
- // If SPDY is disabled, an HTTP request should not be diverted
- // over an SSL session.
- EXPECT_EQ(request_.url.SchemeIs("https"),
- response->was_npn_negotiated);
- }
+ EXPECT_EQ(HttpResponseInfo::ConnectionInfoFromNextProto(kProtoHTTP2),
+ response->connection_info);
+ EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine());
+ EXPECT_TRUE(response->was_fetched_via_spdy);
+ EXPECT_TRUE(response->was_npn_negotiated);
EXPECT_EQ("127.0.0.1", response->socket_address.host());
EXPECT_EQ(443, response->socket_address.port());
output_.status_line = response->headers->GetStatusLine();
@@ -311,7 +292,6 @@ class SpdyNetworkTransactionTest : public ::testing::TestWithParam<bool> {
AlternateVector alternate_vector_;
const BoundNetLog log_;
bool priority_to_dependency_;
- bool spdy_enabled_;
};
void ConnectStatusHelperWithExpectedStatus(const MockRead& status,
@@ -4559,64 +4539,8 @@ TEST_P(SpdyNetworkTransactionTest, VerifyRetryOnConnectionReset) {
}
}
-// Test that turning SPDY on and off works properly.
-TEST_P(SpdyNetworkTransactionTest, SpdyOnOffToggle) {
- HttpStreamFactory::set_spdy_enabled(true);
- std::unique_ptr<SpdySerializedFrame> req(
- spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true));
- MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)};
-
- std::unique_ptr<SpdySerializedFrame> resp(
- spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1));
- std::unique_ptr<SpdySerializedFrame> body(
- spdy_util_.ConstructSpdyBodyFrame(1, true));
- MockRead spdy_reads[] = {
- CreateMockRead(*resp, 1),
- CreateMockRead(*body, 2),
- MockRead(ASYNC, 0, 3) // EOF
- };
-
- SequencedSocketData data(spdy_reads, arraysize(spdy_reads), spdy_writes,
- arraysize(spdy_writes));
- NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
- BoundNetLog(), GetParam(), NULL);
- helper.RunToCompletion(&data);
- TransactionHelperResult out = helper.output();
- EXPECT_THAT(out.rv, IsOk());
- EXPECT_EQ("HTTP/1.1 200", out.status_line);
- EXPECT_EQ("hello!", out.response_data);
-
- HttpStreamFactory::set_spdy_enabled(false);
- MockWrite http_writes[] = {
- MockWrite(SYNCHRONOUS, 0,
- "GET / HTTP/1.1\r\n"
- "Host: www.example.org\r\n"
- "Connection: keep-alive\r\n\r\n"),
- };
-
- MockRead http_reads[] = {
- MockRead(SYNCHRONOUS, 1, "HTTP/1.1 200 OK\r\n\r\n"),
- MockRead(SYNCHRONOUS, 2, "hello from http"),
- MockRead(SYNCHRONOUS, OK, 3),
- };
- SequencedSocketData data2(http_reads, arraysize(http_reads), http_writes,
- arraysize(http_writes));
- NormalSpdyTransactionHelper helper2(CreateGetRequest(), DEFAULT_PRIORITY,
- BoundNetLog(), GetParam(), NULL);
- helper2.SetSpdyDisabled();
- helper2.RunToCompletion(&data2);
- TransactionHelperResult out2 = helper2.output();
- EXPECT_THAT(out2.rv, IsOk());
- EXPECT_EQ("HTTP/1.1 200 OK", out2.status_line);
- EXPECT_EQ("hello from http", out2.response_data);
-
- HttpStreamFactory::set_spdy_enabled(true);
-}
-
// Tests that Basic authentication works over SPDY
TEST_P(SpdyNetworkTransactionTest, SpdyBasicAuth) {
- HttpStreamFactory::set_spdy_enabled(true);
-
// The first request will be a bare GET, the second request will be a
// GET with an Authorization header.
std::unique_ptr<SpdySerializedFrame> req_get(

Powered by Google App Engine
This is Rietveld 408576698