| 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 3472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3483 EXPECT_EQ(1, visitor.error_count_); | 3483 EXPECT_EQ(1, visitor.error_count_); |
| 3484 } else { | 3484 } else { |
| 3485 // In SPDY 4+, duplicate settings are allowed; | 3485 // In SPDY 4+, duplicate settings are allowed; |
| 3486 // each setting replaces the previous value for that setting. | 3486 // each setting replaces the previous value for that setting. |
| 3487 EXPECT_EQ(3, visitor.setting_count_); | 3487 EXPECT_EQ(3, visitor.setting_count_); |
| 3488 EXPECT_EQ(0, visitor.error_count_); | 3488 EXPECT_EQ(0, visitor.error_count_); |
| 3489 EXPECT_EQ(1, visitor.settings_ack_sent_); | 3489 EXPECT_EQ(1, visitor.settings_ack_sent_); |
| 3490 } | 3490 } |
| 3491 } | 3491 } |
| 3492 | 3492 |
| 3493 // Tests handling of SETTINGS_COMPRESS_DATA. |
| 3494 TEST_P(SpdyFramerTest, AcceptSettingsCompressData) { |
| 3495 if (!IsSpdy4()) { return; } |
| 3496 SpdyFramer framer(spdy_version_); |
| 3497 |
| 3498 const unsigned char kFrameData[] = { |
| 3499 0x00, 0x05, 0x04, 0x00, |
| 3500 0x00, 0x00, 0x00, 0x00, |
| 3501 0x05, 0x00, 0x00, 0x00, |
| 3502 0x01, |
| 3503 }; |
| 3504 |
| 3505 TestSpdyVisitor visitor(spdy_version_); |
| 3506 visitor.use_compression_ = false; |
| 3507 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData)); |
| 3508 EXPECT_EQ(1, visitor.setting_count_); |
| 3509 EXPECT_EQ(0, visitor.error_count_); |
| 3510 } |
| 3511 |
| 3493 // Tests handling of SETTINGS frame with entries out of order. | 3512 // Tests handling of SETTINGS frame with entries out of order. |
| 3494 TEST_P(SpdyFramerTest, ReadOutOfOrderSettings) { | 3513 TEST_P(SpdyFramerTest, ReadOutOfOrderSettings) { |
| 3495 SpdyFramer framer(spdy_version_); | 3514 SpdyFramer framer(spdy_version_); |
| 3496 | 3515 |
| 3497 const unsigned char kV2FrameData[] = { | 3516 const unsigned char kV2FrameData[] = { |
| 3498 0x80, spdy_version_ch_, 0x00, 0x04, | 3517 0x80, spdy_version_ch_, 0x00, 0x04, |
| 3499 0x00, 0x00, 0x00, 0x1C, | 3518 0x00, 0x00, 0x00, 0x1C, |
| 3500 0x00, 0x00, 0x00, 0x03, | 3519 0x00, 0x00, 0x00, 0x03, |
| 3501 0x02, 0x00, 0x00, 0x00, // 1st Setting | 3520 0x02, 0x00, 0x00, 0x00, // 1st Setting |
| 3502 0x00, 0x00, 0x00, 0x02, | 3521 0x00, 0x00, 0x00, 0x02, |
| (...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5260 TestSpdyVisitor visitor(spdy_version_); | 5279 TestSpdyVisitor visitor(spdy_version_); |
| 5261 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData)); | 5280 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData)); |
| 5262 | 5281 |
| 5263 EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state()); | 5282 EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state()); |
| 5264 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, | 5283 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, |
| 5265 visitor.framer_.error_code()) | 5284 visitor.framer_.error_code()) |
| 5266 << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code()); | 5285 << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code()); |
| 5267 } | 5286 } |
| 5268 | 5287 |
| 5269 } // namespace net | 5288 } // namespace net |
| OLD | NEW |