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 3013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3024 SpdyFramer framer(spdy_version_); | 3024 SpdyFramer framer(spdy_version_); |
3025 | 3025 |
3026 const char kDescription[] = "BLOCKED frame"; | 3026 const char kDescription[] = "BLOCKED frame"; |
3027 const unsigned char kFrameData[] = { | 3027 const unsigned char kFrameData[] = { |
3028 0x00, 0x08, 0x0b, 0x00, | 3028 0x00, 0x08, 0x0b, 0x00, |
3029 0x00, 0x00, 0x00, 0x00, | 3029 0x00, 0x00, 0x00, 0x00, |
3030 }; | 3030 }; |
3031 SpdyBlockedIR blocked_ir(0); | 3031 SpdyBlockedIR blocked_ir(0); |
3032 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir)); | 3032 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir)); |
3033 CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData)); | 3033 CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData)); |
| 3034 } |
3034 | 3035 |
| 3036 TEST_P(SpdyFramerTest, CreateBlocked) { |
| 3037 if (spdy_version_ < SPDY4) { |
| 3038 return; |
| 3039 } |
| 3040 |
| 3041 SpdyFramer framer(spdy_version_); |
| 3042 |
| 3043 const char kDescription[] = "BLOCKED frame"; |
| 3044 const SpdyStreamId kStreamId = 3; |
| 3045 |
| 3046 scoped_ptr<SpdySerializedFrame> frame_serialized( |
| 3047 framer.CreateBlocked(kStreamId)); |
| 3048 SpdyBlockedIR blocked_ir(kStreamId); |
| 3049 scoped_ptr<SpdySerializedFrame> frame_created( |
| 3050 framer.SerializeFrame(blocked_ir)); |
| 3051 |
| 3052 CompareFrames(kDescription, *frame_serialized, *frame_created); |
3035 } | 3053 } |
3036 | 3054 |
3037 TEST_P(SpdyFramerTest, CreatePushPromiseUncompressed) { | 3055 TEST_P(SpdyFramerTest, CreatePushPromiseUncompressed) { |
3038 if (spdy_version_ < SPDY4) { | 3056 if (spdy_version_ < SPDY4) { |
3039 return; | 3057 return; |
3040 } | 3058 } |
3041 | 3059 |
3042 SpdyFramer framer(spdy_version_); | 3060 SpdyFramer framer(spdy_version_); |
3043 framer.set_enable_compression(false); | 3061 framer.set_enable_compression(false); |
3044 | 3062 |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4592 SpdyBlockedIR blocked_ir(0); | 4610 SpdyBlockedIR blocked_ir(0); |
4593 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir)); | 4611 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir)); |
4594 framer.ProcessInput(frame->data(), framer.GetBlockedSize()); | 4612 framer.ProcessInput(frame->data(), framer.GetBlockedSize()); |
4595 | 4613 |
4596 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); | 4614 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); |
4597 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) | 4615 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) |
4598 << SpdyFramer::ErrorCodeToString(framer.error_code()); | 4616 << SpdyFramer::ErrorCodeToString(framer.error_code()); |
4599 } | 4617 } |
4600 | 4618 |
4601 } // namespace net | 4619 } // namespace net |
OLD | NEW |