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

Side by Side Diff: net/spdy/chromium/spdy_network_transaction_unittest.cc

Issue 2914943002: Use correct error code: REFUSED_STREAM to reject server push from the server in SPDY (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/spdy/chromium/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 <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after
2741 } 2741 }
2742 2742
2743 // Verify that we don't leak streams and that we properly send a reset 2743 // Verify that we don't leak streams and that we properly send a reset
2744 // if the server pushes the same stream twice. 2744 // if the server pushes the same stream twice.
2745 TEST_F(SpdyNetworkTransactionTest, ServerPushDuplicate) { 2745 TEST_F(SpdyNetworkTransactionTest, ServerPushDuplicate) {
2746 SpdySerializedFrame stream1_syn( 2746 SpdySerializedFrame stream1_syn(
2747 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); 2747 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true));
2748 SpdySerializedFrame stream2_priority( 2748 SpdySerializedFrame stream2_priority(
2749 spdy_util_.ConstructSpdyPriority(2, 1, IDLE, true)); 2749 spdy_util_.ConstructSpdyPriority(2, 1, IDLE, true));
2750 SpdySerializedFrame stream3_rst( 2750 SpdySerializedFrame stream3_rst(
2751 spdy_util_.ConstructSpdyRstStream(4, ERROR_CODE_PROTOCOL_ERROR)); 2751 spdy_util_.ConstructSpdyRstStream(4, ERROR_CODE_REFUSED_STREAM));
2752 MockWrite writes[] = { 2752 MockWrite writes[] = {
2753 CreateMockWrite(stream1_syn, 0), CreateMockWrite(stream2_priority, 3), 2753 CreateMockWrite(stream1_syn, 0), CreateMockWrite(stream2_priority, 3),
2754 CreateMockWrite(stream3_rst, 5), 2754 CreateMockWrite(stream3_rst, 5),
2755 }; 2755 };
2756 2756
2757 SpdySerializedFrame stream1_reply( 2757 SpdySerializedFrame stream1_reply(
2758 spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1)); 2758 spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
2759 SpdySerializedFrame stream2_syn(spdy_util_.ConstructSpdyPush( 2759 SpdySerializedFrame stream2_syn(spdy_util_.ConstructSpdyPush(
2760 nullptr, 0, 2, 1, GetDefaultUrlWithPath("/foo.dat").c_str())); 2760 nullptr, 0, 2, 1, GetDefaultUrlWithPath("/foo.dat").c_str()));
2761 SpdySerializedFrame stream3_syn(spdy_util_.ConstructSpdyPush( 2761 SpdySerializedFrame stream3_syn(spdy_util_.ConstructSpdyPush(
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
2911 SpdyHeaderBlock push_promise_header_block; 2911 SpdyHeaderBlock push_promise_header_block;
2912 push_promise_header_block[spdy_util_.GetHostKey()] = ""; 2912 push_promise_header_block[spdy_util_.GetHostKey()] = "";
2913 push_promise_header_block[spdy_util_.GetSchemeKey()] = ""; 2913 push_promise_header_block[spdy_util_.GetSchemeKey()] = "";
2914 push_promise_header_block[spdy_util_.GetPathKey()] = "/index.html"; 2914 push_promise_header_block[spdy_util_.GetPathKey()] = "/index.html";
2915 2915
2916 SpdyPushPromiseIR push_promise(1, 2, std::move(push_promise_header_block)); 2916 SpdyPushPromiseIR push_promise(1, 2, std::move(push_promise_header_block));
2917 SpdySerializedFrame push_promise_frame( 2917 SpdySerializedFrame push_promise_frame(
2918 response_spdy_framer.SerializeFrame(push_promise)); 2918 response_spdy_framer.SerializeFrame(push_promise));
2919 2919
2920 SpdySerializedFrame stream2_rst( 2920 SpdySerializedFrame stream2_rst(
2921 spdy_util_.ConstructSpdyRstStream(2, ERROR_CODE_PROTOCOL_ERROR)); 2921 spdy_util_.ConstructSpdyRstStream(2, ERROR_CODE_REFUSED_STREAM));
2922 2922
2923 MockWrite writes[] = {CreateMockWrite(req, 0), 2923 MockWrite writes[] = {CreateMockWrite(req, 0),
2924 CreateMockWrite(stream2_rst, 2)}; 2924 CreateMockWrite(stream2_rst, 2)};
2925 MockRead reads[] = { 2925 MockRead reads[] = {
2926 CreateMockRead(push_promise_frame, 1), MockRead(ASYNC, 0, 3) /* EOF */ 2926 CreateMockRead(push_promise_frame, 1), MockRead(ASYNC, 0, 3) /* EOF */
2927 }; 2927 };
2928 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); 2928 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes));
2929 RunBrokenPushTest(&data, ERR_CONNECTION_CLOSED); 2929 RunBrokenPushTest(&data, ERR_CONNECTION_CLOSED);
2930 } 2930 }
2931 2931
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 2971
2972 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); 2972 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes));
2973 RunBrokenPushTest(&data, OK); 2973 RunBrokenPushTest(&data, OK);
2974 } 2974 }
2975 2975
2976 TEST_F(SpdyNetworkTransactionTest, ServerPushNoURL) { 2976 TEST_F(SpdyNetworkTransactionTest, ServerPushNoURL) {
2977 SpdySerializedFrame stream1_syn( 2977 SpdySerializedFrame stream1_syn(
2978 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); 2978 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true));
2979 SpdySerializedFrame stream1_body(spdy_util_.ConstructSpdyDataFrame(1, true)); 2979 SpdySerializedFrame stream1_body(spdy_util_.ConstructSpdyDataFrame(1, true));
2980 SpdySerializedFrame stream2_rst( 2980 SpdySerializedFrame stream2_rst(
2981 spdy_util_.ConstructSpdyRstStream(2, ERROR_CODE_PROTOCOL_ERROR)); 2981 spdy_util_.ConstructSpdyRstStream(2, ERROR_CODE_REFUSED_STREAM));
2982 MockWrite writes[] = { 2982 MockWrite writes[] = {
2983 CreateMockWrite(stream1_syn, 0), CreateMockWrite(stream2_rst, 3), 2983 CreateMockWrite(stream1_syn, 0), CreateMockWrite(stream2_rst, 3),
2984 }; 2984 };
2985 2985
2986 SpdySerializedFrame stream1_reply( 2986 SpdySerializedFrame stream1_reply(
2987 spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1)); 2987 spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
2988 SpdyHeaderBlock incomplete_headers; 2988 SpdyHeaderBlock incomplete_headers;
2989 incomplete_headers[spdy_util_.GetStatusKey()] = "200 OK"; 2989 incomplete_headers[spdy_util_.GetStatusKey()] = "200 OK";
2990 incomplete_headers["hello"] = "bye"; 2990 incomplete_headers["hello"] = "bye";
2991 SpdySerializedFrame stream2_syn(spdy_util_.ConstructInitialSpdyPushFrame( 2991 SpdySerializedFrame stream2_syn(spdy_util_.ConstructInitialSpdyPushFrame(
(...skipping 3636 matching lines...) Expand 10 before | Expand all | Expand 10 after
6628 6628
6629 TEST_F(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { 6629 TEST_F(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) {
6630 auto ssl_provider = base::MakeUnique<SSLSocketDataProvider>(ASYNC, OK); 6630 auto ssl_provider = base::MakeUnique<SSLSocketDataProvider>(ASYNC, OK);
6631 // Set to TLS_RSA_WITH_NULL_MD5 6631 // Set to TLS_RSA_WITH_NULL_MD5
6632 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); 6632 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status);
6633 6633
6634 RunTLSUsageCheckTest(std::move(ssl_provider)); 6634 RunTLSUsageCheckTest(std::move(ssl_provider));
6635 } 6635 }
6636 6636
6637 } // namespace net 6637 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/spdy/chromium/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698