| 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 3480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3491 EXPECT_EQ(1, visitor.error_count_); | 3491 EXPECT_EQ(1, visitor.error_count_); |
| 3492 } else { | 3492 } else { |
| 3493 // In SPDY 4+, duplicate settings are allowed; | 3493 // In SPDY 4+, duplicate settings are allowed; |
| 3494 // each setting replaces the previous value for that setting. | 3494 // each setting replaces the previous value for that setting. |
| 3495 EXPECT_EQ(3, visitor.setting_count_); | 3495 EXPECT_EQ(3, visitor.setting_count_); |
| 3496 EXPECT_EQ(0, visitor.error_count_); | 3496 EXPECT_EQ(0, visitor.error_count_); |
| 3497 EXPECT_EQ(1, visitor.settings_ack_sent_); | 3497 EXPECT_EQ(1, visitor.settings_ack_sent_); |
| 3498 } | 3498 } |
| 3499 } | 3499 } |
| 3500 | 3500 |
| 3501 // Tests handling of SETTINGS_COMPRESS_DATA. | |
| 3502 TEST_P(SpdyFramerTest, AcceptSettingsCompressData) { | |
| 3503 if (!IsSpdy4()) { return; } | |
| 3504 SpdyFramer framer(spdy_version_); | |
| 3505 | |
| 3506 const unsigned char kFrameData[] = { | |
| 3507 0x00, 0x05, 0x04, 0x00, | |
| 3508 0x00, 0x00, 0x00, 0x00, | |
| 3509 0x05, 0x00, 0x00, 0x00, | |
| 3510 0x01, | |
| 3511 }; | |
| 3512 | |
| 3513 TestSpdyVisitor visitor(spdy_version_); | |
| 3514 visitor.use_compression_ = false; | |
| 3515 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData)); | |
| 3516 EXPECT_EQ(1, visitor.setting_count_); | |
| 3517 EXPECT_EQ(0, visitor.error_count_); | |
| 3518 } | |
| 3519 | |
| 3520 // Tests handling of SETTINGS frame with entries out of order. | 3501 // Tests handling of SETTINGS frame with entries out of order. |
| 3521 TEST_P(SpdyFramerTest, ReadOutOfOrderSettings) { | 3502 TEST_P(SpdyFramerTest, ReadOutOfOrderSettings) { |
| 3522 SpdyFramer framer(spdy_version_); | 3503 SpdyFramer framer(spdy_version_); |
| 3523 | 3504 |
| 3524 const unsigned char kV2FrameData[] = { | 3505 const unsigned char kV2FrameData[] = { |
| 3525 0x80, spdy_version_ch_, 0x00, 0x04, | 3506 0x80, spdy_version_ch_, 0x00, 0x04, |
| 3526 0x00, 0x00, 0x00, 0x1C, | 3507 0x00, 0x00, 0x00, 0x1C, |
| 3527 0x00, 0x00, 0x00, 0x03, | 3508 0x00, 0x00, 0x00, 0x03, |
| 3528 0x02, 0x00, 0x00, 0x00, // 1st Setting | 3509 0x02, 0x00, 0x00, 0x00, // 1st Setting |
| 3529 0x00, 0x00, 0x00, 0x02, | 3510 0x00, 0x00, 0x00, 0x02, |
| (...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5410 EXPECT_EQ(4u, framer.MapWeightToPriority(109)); | 5391 EXPECT_EQ(4u, framer.MapWeightToPriority(109)); |
| 5411 EXPECT_EQ(4u, framer.MapWeightToPriority(74)); | 5392 EXPECT_EQ(4u, framer.MapWeightToPriority(74)); |
| 5412 EXPECT_EQ(5u, framer.MapWeightToPriority(73)); | 5393 EXPECT_EQ(5u, framer.MapWeightToPriority(73)); |
| 5413 EXPECT_EQ(5u, framer.MapWeightToPriority(37)); | 5394 EXPECT_EQ(5u, framer.MapWeightToPriority(37)); |
| 5414 EXPECT_EQ(6u, framer.MapWeightToPriority(36)); | 5395 EXPECT_EQ(6u, framer.MapWeightToPriority(36)); |
| 5415 EXPECT_EQ(6u, framer.MapWeightToPriority(1)); | 5396 EXPECT_EQ(6u, framer.MapWeightToPriority(1)); |
| 5416 EXPECT_EQ(7u, framer.MapWeightToPriority(0)); | 5397 EXPECT_EQ(7u, framer.MapWeightToPriority(0)); |
| 5417 } | 5398 } |
| 5418 | 5399 |
| 5419 } // namespace net | 5400 } // namespace net |
| OLD | NEW |