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

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

Issue 813993002: Fix crash in handling PushStreams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix crash in handling PushStreams Created 5 years, 11 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 | « net/spdy/spdy_session.cc ('k') | no next file » | 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 "net/spdy/spdy_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 1187
1188 scoped_ptr<SpdyFrame> req( 1188 scoped_ptr<SpdyFrame> req(
1189 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, MEDIUM, true)); 1189 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, MEDIUM, true));
1190 scoped_ptr<SpdyFrame> rst( 1190 scoped_ptr<SpdyFrame> rst(
1191 spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); 1191 spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM));
1192 1192
1193 scoped_ptr<SpdyFrame> push_a(spdy_util_.ConstructSpdyPush( 1193 scoped_ptr<SpdyFrame> push_a(spdy_util_.ConstructSpdyPush(
1194 NULL, 0, 2, 1, "http://www.google.com/a.dat")); 1194 NULL, 0, 2, 1, "http://www.google.com/a.dat"));
1195 scoped_ptr<SpdyFrame> push_a_body( 1195 scoped_ptr<SpdyFrame> push_a_body(
1196 spdy_util_.ConstructSpdyBodyFrame(2, false)); 1196 spdy_util_.ConstructSpdyBodyFrame(2, false));
1197 // In ascii "0" < "a". We use it to verify that we properly handle std::map
1198 // iterators inside. See http://crbug.com/443490
1197 scoped_ptr<SpdyFrame> push_b(spdy_util_.ConstructSpdyPush( 1199 scoped_ptr<SpdyFrame> push_b(spdy_util_.ConstructSpdyPush(
1198 NULL, 0, 4, 1, "http://www.google.com/b.dat")); 1200 NULL, 0, 4, 1, "http://www.google.com/0.dat"));
1199 MockWrite writes[] = {CreateMockWrite(*req, 0), CreateMockWrite(*rst, 4)}; 1201 MockWrite writes[] = {CreateMockWrite(*req, 0), CreateMockWrite(*rst, 4)};
1200 MockRead reads[] = { 1202 MockRead reads[] = {
1201 CreateMockRead(*push_a, 1), CreateMockRead(*push_a_body, 2), 1203 CreateMockRead(*push_a, 1), CreateMockRead(*push_a_body, 2),
1202 CreateMockRead(*push_b, 3), MockRead(ASYNC, 0, 5), // EOF 1204 CreateMockRead(*push_b, 3), MockRead(ASYNC, 0, 5), // EOF
1203 }; 1205 };
1204 DeterministicSocketData data( 1206 DeterministicSocketData data(
1205 reads, arraysize(reads), writes, arraysize(writes)); 1207 reads, arraysize(reads), writes, arraysize(writes));
1206 1208
1207 MockConnect connect_data(SYNCHRONOUS, OK); 1209 MockConnect connect_data(SYNCHRONOUS, OK);
1208 data.set_connect_data(connect_data); 1210 data.set_connect_data(connect_data);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 } 1243 }
1242 1244
1243 // Shift time to expire the push stream. Read the second SYN_STREAM, 1245 // Shift time to expire the push stream. Read the second SYN_STREAM,
1244 // and verify a RST_STREAM was written. 1246 // and verify a RST_STREAM was written.
1245 g_time_delta = base::TimeDelta::FromSeconds(301); 1247 g_time_delta = base::TimeDelta::FromSeconds(301);
1246 data.RunFor(2); 1248 data.RunFor(2);
1247 1249
1248 // Verify that the second pushed stream evicted the first pushed stream. 1250 // Verify that the second pushed stream evicted the first pushed stream.
1249 EXPECT_EQ(1u, session->num_unclaimed_pushed_streams()); 1251 EXPECT_EQ(1u, session->num_unclaimed_pushed_streams());
1250 iter = session->unclaimed_pushed_streams_.find( 1252 iter = session->unclaimed_pushed_streams_.find(
1251 GURL("http://www.google.com/b.dat")); 1253 GURL("http://www.google.com/0.dat"));
1252 EXPECT_TRUE(session->unclaimed_pushed_streams_.end() != iter); 1254 EXPECT_TRUE(session->unclaimed_pushed_streams_.end() != iter);
1253 1255
1254 if (session->flow_control_state_ == 1256 if (session->flow_control_state_ ==
1255 SpdySession::FLOW_CONTROL_STREAM_AND_SESSION) { 1257 SpdySession::FLOW_CONTROL_STREAM_AND_SESSION) {
1256 // Verify that the session window reclaimed the evicted stream body. 1258 // Verify that the session window reclaimed the evicted stream body.
1257 EXPECT_EQ(SpdySession::GetInitialWindowSize(GetParam()), 1259 EXPECT_EQ(SpdySession::GetInitialWindowSize(GetParam()),
1258 session->session_recv_window_size_); 1260 session->session_recv_window_size_);
1259 EXPECT_EQ(kUploadDataSize, session->session_unacked_recv_window_bytes_); 1261 EXPECT_EQ(kUploadDataSize, session->session_unacked_recv_window_bytes_);
1260 } 1262 }
1261 1263
(...skipping 3867 matching lines...) Expand 10 before | Expand all | Expand 10 after
5129 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), 5131 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(),
5130 "spdy_pooling.pem"); 5132 "spdy_pooling.pem");
5131 ssl_info.is_issued_by_known_root = true; 5133 ssl_info.is_issued_by_known_root = true;
5132 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); 5134 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin));
5133 5135
5134 EXPECT_TRUE(SpdySession::CanPool( 5136 EXPECT_TRUE(SpdySession::CanPool(
5135 &tss, ssl_info, "www.example.org", "mail.example.org")); 5137 &tss, ssl_info, "www.example.org", "mail.example.org"));
5136 } 5138 }
5137 5139
5138 } // namespace net 5140 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698