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

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

Issue 485833002: HTTP2 draft 14 support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ignore_result(). Created 6 years, 4 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') | net/spdy/spdy_test_util_common.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 "net/spdy/spdy_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 4934 matching lines...) Expand 10 before | Expand all | Expand 10 after
4945 data.RunFor(1); 4945 data.RunFor(1);
4946 EXPECT_EQ(1u, session->num_active_streams()); 4946 EXPECT_EQ(1u, session->num_active_streams());
4947 EXPECT_EQ(0u, session->num_created_streams()); 4947 EXPECT_EQ(0u, session->num_created_streams());
4948 EXPECT_EQ(0u, session->num_pushed_streams()); 4948 EXPECT_EQ(0u, session->num_pushed_streams());
4949 EXPECT_EQ(0u, session->num_active_pushed_streams()); 4949 EXPECT_EQ(0u, session->num_active_pushed_streams());
4950 4950
4951 // Read EOF. 4951 // Read EOF.
4952 data.RunFor(2); 4952 data.RunFor(2);
4953 } 4953 }
4954 4954
4955 TEST_P(SpdySessionTest, RejectInvalidUnknownFrames) {
4956 session_deps_.host_resolver->set_synchronous_mode(true);
4957
4958 MockRead reads[] = {
4959 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever.
4960 };
4961
4962 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0);
4963
4964 MockConnect connect_data(SYNCHRONOUS, OK);
4965 data.set_connect_data(connect_data);
4966 session_deps_.socket_factory->AddSocketDataProvider(&data);
4967
4968 CreateNetworkSession();
4969 base::WeakPtr<SpdySession> session =
4970 CreateInsecureSpdySession(http_session_, key_, BoundNetLog());
4971
4972 session->stream_hi_water_mark_ = 5;
4973 // Low client (odd) ids are fine.
4974 EXPECT_TRUE(session->OnUnknownFrame(3, 0));
4975 // Client id exceeding watermark.
4976 EXPECT_FALSE(session->OnUnknownFrame(9, 0));
4977 // Currently we do not keep track of server initiated (even) ids.
4978 EXPECT_TRUE(session->OnUnknownFrame(2, 0));
4979 EXPECT_TRUE(session->OnUnknownFrame(8, 0));
4980 }
4981
4955 TEST(MapFramerErrorToProtocolError, MapsValues) { 4982 TEST(MapFramerErrorToProtocolError, MapsValues) {
4956 CHECK_EQ( 4983 CHECK_EQ(
4957 SPDY_ERROR_INVALID_CONTROL_FRAME, 4984 SPDY_ERROR_INVALID_CONTROL_FRAME,
4958 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_CONTROL_FRAME)); 4985 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_CONTROL_FRAME));
4959 CHECK_EQ( 4986 CHECK_EQ(
4960 SPDY_ERROR_INVALID_DATA_FRAME_FLAGS, 4987 SPDY_ERROR_INVALID_DATA_FRAME_FLAGS,
4961 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS)); 4988 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS));
4962 CHECK_EQ( 4989 CHECK_EQ(
4963 SPDY_ERROR_GOAWAY_FRAME_CORRUPT, 4990 SPDY_ERROR_GOAWAY_FRAME_CORRUPT,
4964 MapFramerErrorToProtocolError(SpdyFramer::SPDY_GOAWAY_FRAME_CORRUPT)); 4991 MapFramerErrorToProtocolError(SpdyFramer::SPDY_GOAWAY_FRAME_CORRUPT));
(...skipping 30 matching lines...) Expand all
4995 CHECK_EQ(GOAWAY_PROTOCOL_ERROR, 5022 CHECK_EQ(GOAWAY_PROTOCOL_ERROR,
4996 MapNetErrorToGoAwayStatus(ERR_SPDY_PROTOCOL_ERROR)); 5023 MapNetErrorToGoAwayStatus(ERR_SPDY_PROTOCOL_ERROR));
4997 CHECK_EQ(GOAWAY_COMPRESSION_ERROR, 5024 CHECK_EQ(GOAWAY_COMPRESSION_ERROR,
4998 MapNetErrorToGoAwayStatus(ERR_SPDY_COMPRESSION_ERROR)); 5025 MapNetErrorToGoAwayStatus(ERR_SPDY_COMPRESSION_ERROR));
4999 CHECK_EQ(GOAWAY_FRAME_SIZE_ERROR, 5026 CHECK_EQ(GOAWAY_FRAME_SIZE_ERROR,
5000 MapNetErrorToGoAwayStatus(ERR_SPDY_FRAME_SIZE_ERROR)); 5027 MapNetErrorToGoAwayStatus(ERR_SPDY_FRAME_SIZE_ERROR));
5001 CHECK_EQ(GOAWAY_PROTOCOL_ERROR, MapNetErrorToGoAwayStatus(ERR_UNEXPECTED)); 5028 CHECK_EQ(GOAWAY_PROTOCOL_ERROR, MapNetErrorToGoAwayStatus(ERR_UNEXPECTED));
5002 } 5029 }
5003 5030
5004 } // namespace net 5031 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_test_util_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698