OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |