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

Unified Diff: net/spdy/bidirectional_stream_spdy_impl_unittest.cc

Issue 2111953002: Minor test cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/quic/quic_stream_factory_test.cc ('k') | net/spdy/spdy_http_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/bidirectional_stream_spdy_impl_unittest.cc
diff --git a/net/spdy/bidirectional_stream_spdy_impl_unittest.cc b/net/spdy/bidirectional_stream_spdy_impl_unittest.cc
index 62572dc3e458d93df3414be43a1e05454dd4c84c..86ffbfda8e012c00bc7e1f059a6a4cff9a213307 100644
--- a/net/spdy/bidirectional_stream_spdy_impl_unittest.cc
+++ b/net/spdy/bidirectional_stream_spdy_impl_unittest.cc
@@ -204,6 +204,9 @@ class BidirectionalStreamSpdyImplTest : public testing::Test {
BidirectionalStreamSpdyImplTest()
: spdy_util_(kProtoHTTP2, true),
session_deps_(kProtoHTTP2),
+ default_url_(kDefaultUrl),
+ host_port_pair_(HostPortPair::FromURL(default_url_)),
+ key_(host_port_pair_, ProxyServer::Direct(), PRIVACY_MODE_DISABLED),
ssl_data_(SSLSocketDataProvider(ASYNC, OK)) {
ssl_data_.SetNextProto(kProtoHTTP2);
ssl_data_.cert = ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem");
@@ -221,8 +224,7 @@ class BidirectionalStreamSpdyImplTest : public testing::Test {
void InitSession(MockRead* reads,
size_t reads_count,
MockWrite* writes,
- size_t writes_count,
- const SpdySessionKey& key) {
+ size_t writes_count) {
ASSERT_TRUE(ssl_data_.cert.get());
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data_);
sequenced_data_.reset(
@@ -231,12 +233,15 @@ class BidirectionalStreamSpdyImplTest : public testing::Test {
session_deps_.net_log = net_log_.bound().net_log();
http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_);
session_ =
- CreateSecureSpdySession(http_session_.get(), key, net_log_.bound());
+ CreateSecureSpdySession(http_session_.get(), key_, net_log_.bound());
}
BoundTestNetLog net_log_;
SpdyTestUtil spdy_util_;
SpdySessionDependencies session_deps_;
+ const GURL default_url_;
+ const HostPortPair host_port_pair_;
+ const SpdySessionKey key_;
std::unique_ptr<SequencedSocketData> sequenced_data_;
std::unique_ptr<HttpNetworkSession> http_session_;
base::WeakPtr<SpdySession> session_;
@@ -247,7 +252,7 @@ class BidirectionalStreamSpdyImplTest : public testing::Test {
TEST_F(BidirectionalStreamSpdyImplTest, SendDataAfterStreamFailed) {
std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost(
- "https://www.example.org", 1, kBodyDataSize * 3, LOW, nullptr, 0));
+ kDefaultUrl, 1, kBodyDataSize * 3, LOW, nullptr, 0));
std::unique_ptr<SpdySerializedFrame> rst(
spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_PROTOCOL_ERROR));
@@ -263,14 +268,11 @@ TEST_F(BidirectionalStreamSpdyImplTest, SendDataAfterStreamFailed) {
CreateMockRead(*resp, 1), MockRead(ASYNC, 0, 3),
};
- HostPortPair host_port_pair("www.example.org", 443);
- SpdySessionKey key(host_port_pair, ProxyServer::Direct(),
- PRIVACY_MODE_DISABLED);
- InitSession(reads, arraysize(reads), writes, arraysize(writes), key);
+ InitSession(reads, arraysize(reads), writes, arraysize(writes));
BidirectionalStreamRequestInfo request_info;
request_info.method = "POST";
- request_info.url = GURL("https://www.example.org/");
+ request_info.url = default_url_;
request_info.extra_headers.SetHeader(net::HttpRequestHeaders::kContentLength,
base::SizeTToString(kBodyDataSize * 3));
@@ -303,7 +305,7 @@ TEST_F(BidirectionalStreamSpdyImplTest, SendDataAfterCancelStream) {
BufferedSpdyFramer framer(spdy_util_.spdy_version());
std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost(
- "https://www.example.org", 1, kBodyDataSize * 3, LOWEST, nullptr, 0));
+ kDefaultUrl, 1, kBodyDataSize * 3, LOWEST, nullptr, 0));
std::unique_ptr<SpdySerializedFrame> data_frame(
framer.CreateDataFrame(1, kBodyData, kBodyDataSize, DATA_FLAG_NONE));
std::unique_ptr<SpdySerializedFrame> rst(
@@ -326,14 +328,11 @@ TEST_F(BidirectionalStreamSpdyImplTest, SendDataAfterCancelStream) {
MockRead(ASYNC, 0, 6),
};
- HostPortPair host_port_pair("www.example.org", 443);
- SpdySessionKey key(host_port_pair, ProxyServer::Direct(),
- PRIVACY_MODE_DISABLED);
- InitSession(reads, arraysize(reads), writes, arraysize(writes), key);
+ InitSession(reads, arraysize(reads), writes, arraysize(writes));
BidirectionalStreamRequestInfo request_info;
request_info.method = "POST";
- request_info.url = GURL("https://www.example.org/");
+ request_info.url = default_url_;
request_info.priority = LOWEST;
request_info.extra_headers.SetHeader(net::HttpRequestHeaders::kContentLength,
base::SizeTToString(kBodyDataSize * 3));
« no previous file with comments | « net/quic/quic_stream_factory_test.cc ('k') | net/spdy/spdy_http_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698