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

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

Issue 511283005: Go away on odd push and already seen push stream ids (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add push stream handling to OnUnknownFrame Created 6 years, 3 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 4957 matching lines...) Expand 10 before | Expand all | Expand 10 after
4968 4968
4969 CreateNetworkSession(); 4969 CreateNetworkSession();
4970 base::WeakPtr<SpdySession> session = 4970 base::WeakPtr<SpdySession> session =
4971 CreateInsecureSpdySession(http_session_, key_, BoundNetLog()); 4971 CreateInsecureSpdySession(http_session_, key_, BoundNetLog());
4972 4972
4973 session->stream_hi_water_mark_ = 5; 4973 session->stream_hi_water_mark_ = 5;
4974 // Low client (odd) ids are fine. 4974 // Low client (odd) ids are fine.
4975 EXPECT_TRUE(session->OnUnknownFrame(3, 0)); 4975 EXPECT_TRUE(session->OnUnknownFrame(3, 0));
4976 // Client id exceeding watermark. 4976 // Client id exceeding watermark.
4977 EXPECT_FALSE(session->OnUnknownFrame(9, 0)); 4977 EXPECT_FALSE(session->OnUnknownFrame(9, 0));
4978 // Currently we do not keep track of server initiated (even) ids. 4978
4979 session->last_accepted_push_stream_id_ = 6;
4980 // Low server (even) ids are fine.
4979 EXPECT_TRUE(session->OnUnknownFrame(2, 0)); 4981 EXPECT_TRUE(session->OnUnknownFrame(2, 0));
4980 EXPECT_TRUE(session->OnUnknownFrame(8, 0)); 4982 // Server id exceeding last accepted id.
4983 EXPECT_FALSE(session->OnUnknownFrame(8, 0));
4981 } 4984 }
4982 4985
4983 TEST(MapFramerErrorToProtocolError, MapsValues) { 4986 TEST(MapFramerErrorToProtocolError, MapsValues) {
4984 CHECK_EQ( 4987 CHECK_EQ(
4985 SPDY_ERROR_INVALID_CONTROL_FRAME, 4988 SPDY_ERROR_INVALID_CONTROL_FRAME,
4986 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_CONTROL_FRAME)); 4989 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_CONTROL_FRAME));
4987 CHECK_EQ( 4990 CHECK_EQ(
4988 SPDY_ERROR_INVALID_DATA_FRAME_FLAGS, 4991 SPDY_ERROR_INVALID_DATA_FRAME_FLAGS,
4989 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS)); 4992 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS));
4990 CHECK_EQ( 4993 CHECK_EQ(
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
5127 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), 5130 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(),
5128 "spdy_pooling.pem"); 5131 "spdy_pooling.pem");
5129 ssl_info.is_issued_by_known_root = true; 5132 ssl_info.is_issued_by_known_root = true;
5130 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); 5133 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin));
5131 5134
5132 EXPECT_TRUE(SpdySession::CanPool( 5135 EXPECT_TRUE(SpdySession::CanPool(
5133 &tss, ssl_info, "www.example.org", "mail.example.org")); 5136 &tss, ssl_info, "www.example.org", "mail.example.org"));
5134 } 5137 }
5135 5138
5136 } // namespace net 5139 } // 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