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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/spdy/spdy_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 #include <memory> 6 #include <memory>
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2843 matching lines...) Expand 10 before | Expand all | Expand 10 after
2854 2854
2855 // Verify the response headers. 2855 // Verify the response headers.
2856 EXPECT_TRUE(response.headers); 2856 EXPECT_TRUE(response.headers);
2857 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); 2857 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine());
2858 2858
2859 // Verify the pushed stream. 2859 // Verify the pushed stream.
2860 EXPECT_TRUE(response2.headers); 2860 EXPECT_TRUE(response2.headers);
2861 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); 2861 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine());
2862 } 2862 }
2863 2863
2864 TEST_F(SpdyNetworkTransactionTest, ServerPushInvalidUrl) {
2865 // Coverage on how a non-empty invalid GURL in a PUSH_PROMISE is handled.
2866 SpdyHeaderBlock headers(spdy_util_.ConstructGetHeaderBlock(kDefaultUrl));
2867 SpdySerializedFrame req(
2868 spdy_util_.ConstructSpdyHeaders(1, std::move(headers), LOWEST, true));
2869
2870 // Can't use ConstructSpdyPush here since it wants to parse a URL and
2871 // split it into the appropriate :header pieces. So we have to hand-fill
2872 // those pieces in.
2873 SpdyFramer response_spdy_framer(SpdyFramer::ENABLE_COMPRESSION);
2874 SpdyHeaderBlock push_promise_header_block;
2875 push_promise_header_block[spdy_util_.GetHostKey()] = "";
2876 push_promise_header_block[spdy_util_.GetSchemeKey()] = "";
2877 push_promise_header_block[spdy_util_.GetPathKey()] = "/index.html";
2878
2879 SpdyPushPromiseIR push_promise(1, 2, std::move(push_promise_header_block));
2880 SpdySerializedFrame push_promise_frame(
2881 response_spdy_framer.SerializeFrame(push_promise));
2882
2883 SpdySerializedFrame stream2_rst(
2884 spdy_util_.ConstructSpdyRstStream(2, ERROR_CODE_PROTOCOL_ERROR));
2885
2886 MockWrite writes[] = {CreateMockWrite(req, 0),
2887 CreateMockWrite(stream2_rst, 2)};
2888 MockRead reads[] = {
2889 CreateMockRead(push_promise_frame, 1), MockRead(ASYNC, 0, 3) /* EOF */
2890 };
2891 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes));
2892
2893 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
2894 NetLogWithSource(), nullptr);
2895 helper.RunPreTestSetup();
2896 helper.AddData(&data);
2897
2898 HttpNetworkTransaction* trans = helper.trans();
2899
2900 TestCompletionCallback callback;
2901 int rv = trans->Start(&CreateGetRequest(), callback.callback(),
2902 NetLogWithSource());
2903 EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
2904 rv = callback.WaitForResult();
Bence 2017/02/06 20:48:48 Did you not want to test the value of |rv| after t
2905
2906 base::RunLoop().RunUntilIdle();
2907
2908 EXPECT_TRUE(data.AllReadDataConsumed());
2909 EXPECT_TRUE(data.AllWriteDataConsumed());
2910 }
2911
2864 TEST_F(SpdyNetworkTransactionTest, ServerPushInvalidAssociatedStreamID0) { 2912 TEST_F(SpdyNetworkTransactionTest, ServerPushInvalidAssociatedStreamID0) {
2865 SpdySerializedFrame stream1_syn( 2913 SpdySerializedFrame stream1_syn(
2866 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); 2914 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true));
2867 SpdySerializedFrame goaway(spdy_util_.ConstructSpdyGoAway( 2915 SpdySerializedFrame goaway(spdy_util_.ConstructSpdyGoAway(
2868 0, ERROR_CODE_PROTOCOL_ERROR, "Framer error: 1 (INVALID_STREAM_ID).")); 2916 0, ERROR_CODE_PROTOCOL_ERROR, "Framer error: 1 (INVALID_STREAM_ID)."));
2869 MockWrite writes[] = { 2917 MockWrite writes[] = {
2870 CreateMockWrite(stream1_syn, 0), CreateMockWrite(goaway, 3), 2918 CreateMockWrite(stream1_syn, 0), CreateMockWrite(goaway, 3),
2871 }; 2919 };
2872 2920
2873 SpdySerializedFrame stream1_reply( 2921 SpdySerializedFrame stream1_reply(
(...skipping 3682 matching lines...) Expand 10 before | Expand all | Expand 10 after
6556 TEST_F(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { 6604 TEST_F(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) {
6557 std::unique_ptr<SSLSocketDataProvider> ssl_provider( 6605 std::unique_ptr<SSLSocketDataProvider> ssl_provider(
6558 new SSLSocketDataProvider(ASYNC, OK)); 6606 new SSLSocketDataProvider(ASYNC, OK));
6559 // Set to TLS_RSA_WITH_NULL_MD5 6607 // Set to TLS_RSA_WITH_NULL_MD5
6560 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); 6608 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status);
6561 6609
6562 RunTLSUsageCheckTest(std::move(ssl_provider)); 6610 RunTLSUsageCheckTest(std::move(ssl_provider));
6563 } 6611 }
6564 6612
6565 } // namespace net 6613 } // namespace net
OLDNEW
« 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