| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <iostream> | 6 #include <iostream> |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 3251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3262 SpdyPushPromiseIR push_promise(42, 57); | 3262 SpdyPushPromiseIR push_promise(42, 57); |
| 3263 push_promise.set_padding_len(177); | 3263 push_promise.set_padding_len(177); |
| 3264 push_promise.SetHeader("bar", "foo"); | 3264 push_promise.SetHeader("bar", "foo"); |
| 3265 push_promise.SetHeader("foo", "bar"); | 3265 push_promise.SetHeader("foo", "bar"); |
| 3266 scoped_ptr<SpdySerializedFrame> frame( | 3266 scoped_ptr<SpdySerializedFrame> frame( |
| 3267 framer.SerializePushPromise(push_promise)); | 3267 framer.SerializePushPromise(push_promise)); |
| 3268 CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData)); | 3268 CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData)); |
| 3269 } | 3269 } |
| 3270 } | 3270 } |
| 3271 | 3271 |
| 3272 TEST_P(SpdyFramerTest, GetNumberRequiredContinuationFrames) { |
| 3273 if (spdy_version_ <= SPDY3) { |
| 3274 return; |
| 3275 } |
| 3276 |
| 3277 SpdyFramer framer(spdy_version_); |
| 3278 // Test case from https://crbug.com/464748. |
| 3279 EXPECT_EQ(1u, framer.GetNumberRequiredContinuationFrames(2039)); |
| 3280 EXPECT_EQ(2u, framer.GetNumberRequiredContinuationFrames(2040)); |
| 3281 } |
| 3282 |
| 3272 TEST_P(SpdyFramerTest, CreateContinuationUncompressed) { | 3283 TEST_P(SpdyFramerTest, CreateContinuationUncompressed) { |
| 3273 if (spdy_version_ <= SPDY3) { | 3284 if (spdy_version_ <= SPDY3) { |
| 3274 return; | 3285 return; |
| 3275 } | 3286 } |
| 3276 | 3287 |
| 3277 SpdyFramer framer(spdy_version_); | 3288 SpdyFramer framer(spdy_version_); |
| 3278 framer.set_enable_compression(false); | 3289 framer.set_enable_compression(false); |
| 3279 const char kDescription[] = "CONTINUATION frame"; | 3290 const char kDescription[] = "CONTINUATION frame"; |
| 3280 | 3291 |
| 3281 const unsigned char kFrameData[] = { | 3292 const unsigned char kFrameData[] = { |
| (...skipping 2649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5931 TestSpdyVisitor visitor(spdy_version_); | 5942 TestSpdyVisitor visitor(spdy_version_); |
| 5932 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData)); | 5943 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData)); |
| 5933 | 5944 |
| 5934 EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state()); | 5945 EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state()); |
| 5935 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, | 5946 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, |
| 5936 visitor.framer_.error_code()) | 5947 visitor.framer_.error_code()) |
| 5937 << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code()); | 5948 << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code()); |
| 5938 } | 5949 } |
| 5939 | 5950 |
| 5940 } // namespace net | 5951 } // namespace net |
| OLD | NEW |