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

Unified Diff: net/spdy/spdy_network_transaction_unittest.cc

Issue 2673363003: Don't access .spec on a !is_valid PUSH_PROMISE URL. (Closed)
Patch Set: comment formatting tweak Created 3 years, 10 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 | « no previous file | net/spdy/spdy_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ca0372801977dc6b9ed161a5110a11669b03c212..b08a03130fac880ad120b73725a02ecb400a27ea 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -2861,6 +2861,54 @@ TEST_F(SpdyNetworkTransactionTest, ServerPushMultipleDataFrameInterrupted) {
EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine());
}
+TEST_F(SpdyNetworkTransactionTest, ServerPushInvalidUrl) {
+ // Coverage on how a non-empty invalid GURL in a PUSH_PROMISE is handled.
+ SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(kDefaultUrl));
+ SpdySerializedFrame req(
+ spdy_util_.ConstructSpdyHeaders(1, std::move(headers), LOWEST, true));
+
+ // Can't use ConstructSpdyPush here since it wants to parse a URL and
+ // split it into the appropriate :header pieces. So we have to hand-fill
+ // those pieces in.
+ SpdyFramer response_spdy_framer(SpdyFramer::ENABLE_COMPRESSION);
+ SpdyHeaderBlock push_promise_header_block;
+ push_promise_header_block[spdy_util_.GetHostKey()] = "";
+ push_promise_header_block[spdy_util_.GetSchemeKey()] = "";
+ push_promise_header_block[spdy_util_.GetPathKey()] = "/index.html";
+
+ SpdyPushPromiseIR push_promise(1, 2, std::move(push_promise_header_block));
+ SpdySerializedFrame push_promise_frame(
+ response_spdy_framer.SerializeFrame(push_promise));
+
+ SpdySerializedFrame stream2_rst(
+ spdy_util_.ConstructSpdyRstStream(2, ERROR_CODE_PROTOCOL_ERROR));
+
+ MockWrite writes[] = {CreateMockWrite(req, 0),
+ CreateMockWrite(stream2_rst, 2)};
+ MockRead reads[] = {
+ CreateMockRead(push_promise_frame, 1), MockRead(ASYNC, 0, 3) /* EOF */
+ };
+ SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes));
+
+ NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
Maks Orlovich 2017/02/06 19:22:31 Lots of boilerplate overlap here with methods belo
Bence 2017/02/06 20:48:48 Whatever you think makes sense. There's a lot of
+ NetLogWithSource(), nullptr);
+ helper.RunPreTestSetup();
+ helper.AddData(&data);
+
+ HttpNetworkTransaction* trans = helper.trans();
+
+ TestCompletionCallback callback;
+ int rv = trans->Start(&CreateGetRequest(), callback.callback(),
+ NetLogWithSource());
+ EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
+ rv = callback.WaitForResult();
Bence 2017/02/06 20:48:48 Did you not want to test the value of |rv| after t
+
+ base::RunLoop().RunUntilIdle();
+
+ EXPECT_TRUE(data.AllReadDataConsumed());
+ EXPECT_TRUE(data.AllWriteDataConsumed());
+}
+
TEST_F(SpdyNetworkTransactionTest, ServerPushInvalidAssociatedStreamID0) {
SpdySerializedFrame stream1_syn(
spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true));
« no previous file with comments | « no previous file | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698