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

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

Issue 17004007: [SPDY] Fix SpdySession's handling of SYN_REPLY frames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2188 MockRead reads[] = { 2188 MockRead reads[] = {
2189 CreateMockRead(*body), 2189 CreateMockRead(*body),
2190 MockRead(ASYNC, 0, 0) // EOF 2190 MockRead(ASYNC, 0, 0) // EOF
2191 }; 2191 };
2192 2192
2193 DelayedSocketData data(1, reads, arraysize(reads), NULL, 0); 2193 DelayedSocketData data(1, reads, arraysize(reads), NULL, 0);
2194 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, 2194 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
2195 BoundNetLog(), GetParam(), NULL); 2195 BoundNetLog(), GetParam(), NULL);
2196 helper.RunToCompletion(&data); 2196 helper.RunToCompletion(&data);
2197 TransactionHelperResult out = helper.output(); 2197 TransactionHelperResult out = helper.output();
2198 EXPECT_EQ(ERR_SYN_REPLY_NOT_RECEIVED, out.rv); 2198 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv);
2199 } 2199 }
2200 2200
2201 // Test that the transaction doesn't crash when we get two replies on the same 2201 // Test that the transaction doesn't crash when we get two replies on the same
2202 // stream ID. See http://crbug.com/45639. 2202 // stream ID. See http://crbug.com/45639.
2203 TEST_P(SpdyNetworkTransactionTest, ResponseWithTwoSynReplies) { 2203 TEST_P(SpdyNetworkTransactionTest, ResponseWithTwoSynReplies) {
2204 if (GetParam().protocol > kProtoSPDY3) 2204 if (GetParam().protocol > kProtoSPDY3)
2205 return; 2205 return;
2206 2206
2207 scoped_ptr<SpdyFrame> req( 2207 scoped_ptr<SpdyFrame> req(
2208 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); 2208 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true));
2209 MockWrite writes[] = { CreateMockWrite(*req) }; 2209 scoped_ptr<SpdyFrame> rst(
2210 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_STREAM_IN_USE));
2211 MockWrite writes[] = {
2212 CreateMockWrite(*req),
2213 CreateMockWrite(*rst),
2214 };
2210 2215
2211 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); 2216 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1));
2212 scoped_ptr<SpdyFrame> body(spdy_util_.ConstructSpdyBodyFrame(1, true)); 2217 scoped_ptr<SpdyFrame> body(spdy_util_.ConstructSpdyBodyFrame(1, true));
2213 MockRead reads[] = { 2218 MockRead reads[] = {
2214 CreateMockRead(*resp), 2219 CreateMockRead(*resp),
2215 CreateMockRead(*resp), 2220 CreateMockRead(*resp),
2216 CreateMockRead(*body), 2221 CreateMockRead(*body),
2217 MockRead(ASYNC, 0, 0) // EOF 2222 MockRead(ASYNC, 0, 0) // EOF
2218 }; 2223 };
2219 2224
(...skipping 4544 matching lines...) Expand 10 before | Expand all | Expand 10 after
6764 // And now we can allow everything else to run to completion. 6769 // And now we can allow everything else to run to completion.
6765 data.SetStop(10); 6770 data.SetStop(10);
6766 data.Run(); 6771 data.Run();
6767 EXPECT_EQ(OK, callback2.WaitForResult()); 6772 EXPECT_EQ(OK, callback2.WaitForResult());
6768 EXPECT_EQ(OK, callback3.WaitForResult()); 6773 EXPECT_EQ(OK, callback3.WaitForResult());
6769 6774
6770 helper.VerifyDataConsumed(); 6775 helper.VerifyDataConsumed();
6771 } 6776 }
6772 6777
6773 } // namespace net 6778 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698