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 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2330 0x0a, 0x0b, 0x0c, 0x0d, | 2330 0x0a, 0x0b, 0x0c, 0x0d, |
2331 }; | 2331 }; |
2332 const unsigned char kV3FrameData[] = { | 2332 const unsigned char kV3FrameData[] = { |
2333 0x80, spdy_version_ch_, 0x00, 0x04, | 2333 0x80, spdy_version_ch_, 0x00, 0x04, |
2334 0x00, 0x00, 0x00, 0x0c, | 2334 0x00, 0x00, 0x00, 0x0c, |
2335 0x00, 0x00, 0x00, 0x01, | 2335 0x00, 0x00, 0x00, 0x01, |
2336 0x01, 0x00, 0x00, 0x07, | 2336 0x01, 0x00, 0x00, 0x07, |
2337 0x0a, 0x0b, 0x0c, 0x0d, | 2337 0x0a, 0x0b, 0x0c, 0x0d, |
2338 }; | 2338 }; |
2339 const unsigned char kV4FrameData[] = { | 2339 const unsigned char kV4FrameData[] = { |
2340 0x00, 0x05, 0x04, 0x00, | 2340 0x00, 0x06, 0x04, 0x00, |
2341 0x00, 0x00, 0x00, 0x00, | 2341 0x00, 0x00, 0x00, 0x00, |
2342 0x04, 0x0a, 0x0b, 0x0c, | 2342 0x00, 0x04, 0x0a, 0x0b, |
2343 0x0d, | 2343 0x0c, 0x0d, |
2344 }; | 2344 }; |
2345 | 2345 |
2346 uint32 kValue = 0x0a0b0c0d; | 2346 uint32 kValue = 0x0a0b0c0d; |
2347 SpdySettingsIR settings_ir; | 2347 SpdySettingsIR settings_ir; |
2348 | 2348 |
2349 SpdySettingsFlags kFlags = static_cast<SpdySettingsFlags>(0x01); | 2349 SpdySettingsFlags kFlags = static_cast<SpdySettingsFlags>(0x01); |
2350 SpdySettingsIds kId = SETTINGS_INITIAL_WINDOW_SIZE; | 2350 SpdySettingsIds kId = SETTINGS_INITIAL_WINDOW_SIZE; |
2351 SettingsMap settings; | 2351 SettingsMap settings; |
2352 settings[kId] = SettingsFlagsAndValue(kFlags, kValue); | 2352 settings[kId] = SettingsFlagsAndValue(kFlags, kValue); |
2353 EXPECT_EQ(kFlags, settings[kId].first); | 2353 EXPECT_EQ(kFlags, settings[kId].first); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2393 0x00, 0x00, 0x00, 0x06, | 2393 0x00, 0x00, 0x00, 0x06, |
2394 0x00, 0x00, 0x00, 0x03, // 3rd Setting | 2394 0x00, 0x00, 0x00, 0x03, // 3rd Setting |
2395 0x00, 0x00, 0x00, 0x07, | 2395 0x00, 0x00, 0x00, 0x07, |
2396 0x00, 0x00, 0x00, 0x04, // 4th Setting | 2396 0x00, 0x00, 0x00, 0x04, // 4th Setting |
2397 0x00, 0x00, 0x00, 0x08, | 2397 0x00, 0x00, 0x00, 0x08, |
2398 }; | 2398 }; |
2399 // These end up seemingly out of order because of the way that our internal | 2399 // These end up seemingly out of order because of the way that our internal |
2400 // ordering for settings_ir works. HTTP2 has no requirement on ordering on | 2400 // ordering for settings_ir works. HTTP2 has no requirement on ordering on |
2401 // the wire. | 2401 // the wire. |
2402 const unsigned char kV4FrameData[] = { | 2402 const unsigned char kV4FrameData[] = { |
2403 0x00, 0x14, 0x04, 0x00, | 2403 0x00, 0x18, 0x04, 0x00, |
2404 0x00, 0x00, 0x00, 0x00, | 2404 0x00, 0x00, 0x00, 0x00, |
2405 0x03, // 3rd Setting | 2405 0x00, 0x03, // 3rd Setting |
2406 0x00, 0x00, 0x00, 0x07, | 2406 0x00, 0x00, 0x00, 0x07, |
2407 0x04, // 4th Setting | 2407 0x00, 0x04, // 4th Setting |
2408 0x00, 0x00, 0x00, 0x08, | 2408 0x00, 0x00, 0x00, 0x08, |
2409 0x01, // 1st Setting | 2409 0x00, 0x01, // 1st Setting |
2410 0x00, 0x00, 0x00, 0x05, | 2410 0x00, 0x00, 0x00, 0x05, |
2411 0x02, // 2nd Setting | 2411 0x00, 0x02, // 2nd Setting |
2412 0x00, 0x00, 0x00, 0x06, | 2412 0x00, 0x00, 0x00, 0x06, |
2413 }; | 2413 }; |
2414 | 2414 |
2415 SpdySettingsIR settings_ir; | 2415 SpdySettingsIR settings_ir; |
2416 settings_ir.AddSetting(SpdyConstants::ParseSettingId(spdy_version_, 1), | 2416 settings_ir.AddSetting(SpdyConstants::ParseSettingId(spdy_version_, 1), |
2417 false, // persist | 2417 false, // persist |
2418 false, // persisted | 2418 false, // persisted |
2419 5); | 2419 5); |
2420 settings_ir.AddSetting(SpdyConstants::ParseSettingId(spdy_version_, 2), | 2420 settings_ir.AddSetting(SpdyConstants::ParseSettingId(spdy_version_, 2), |
2421 false, // persist | 2421 false, // persist |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3458 0x00, 0x00, 0x00, 0x1C, | 3458 0x00, 0x00, 0x00, 0x1C, |
3459 0x00, 0x00, 0x00, 0x03, | 3459 0x00, 0x00, 0x00, 0x03, |
3460 0x00, 0x00, 0x00, 0x01, // 1st Setting | 3460 0x00, 0x00, 0x00, 0x01, // 1st Setting |
3461 0x00, 0x00, 0x00, 0x02, | 3461 0x00, 0x00, 0x00, 0x02, |
3462 0x00, 0x00, 0x00, 0x01, // 2nd (duplicate) Setting | 3462 0x00, 0x00, 0x00, 0x01, // 2nd (duplicate) Setting |
3463 0x00, 0x00, 0x00, 0x03, | 3463 0x00, 0x00, 0x00, 0x03, |
3464 0x00, 0x00, 0x00, 0x03, // 3rd (unprocessed) Setting | 3464 0x00, 0x00, 0x00, 0x03, // 3rd (unprocessed) Setting |
3465 0x00, 0x00, 0x00, 0x03, | 3465 0x00, 0x00, 0x00, 0x03, |
3466 }; | 3466 }; |
3467 const unsigned char kV4FrameData[] = { | 3467 const unsigned char kV4FrameData[] = { |
3468 0x00, 0x0f, 0x04, 0x00, | 3468 0x00, 0x12, 0x04, 0x00, |
3469 0x00, 0x00, 0x00, 0x00, | 3469 0x00, 0x00, 0x00, 0x00, |
3470 0x01, // 1st Setting | 3470 0x00, 0x01, // 1st Setting |
3471 0x00, 0x00, 0x00, 0x02, | 3471 0x00, 0x00, 0x00, 0x02, |
3472 0x01, // 2nd (duplicate) Setting | 3472 0x00, 0x01, // 2nd (duplicate) Setting |
3473 0x00, 0x00, 0x00, 0x03, | 3473 0x00, 0x00, 0x00, 0x03, |
3474 0x03, // 3rd (unprocessed) Setting | 3474 0x00, 0x03, // 3rd (unprocessed) Setting |
3475 0x00, 0x00, 0x00, 0x03, | 3475 0x00, 0x00, 0x00, 0x03, |
3476 }; | 3476 }; |
3477 | 3477 |
3478 TestSpdyVisitor visitor(spdy_version_); | 3478 TestSpdyVisitor visitor(spdy_version_); |
3479 visitor.use_compression_ = false; | 3479 visitor.use_compression_ = false; |
3480 if (IsSpdy2()) { | 3480 if (IsSpdy2()) { |
3481 visitor.SimulateInFramer(kV2FrameData, sizeof(kV2FrameData)); | 3481 visitor.SimulateInFramer(kV2FrameData, sizeof(kV2FrameData)); |
3482 } else if (IsSpdy3()) { | 3482 } else if (IsSpdy3()) { |
3483 visitor.SimulateInFramer(kV3FrameData, sizeof(kV3FrameData)); | 3483 visitor.SimulateInFramer(kV3FrameData, sizeof(kV3FrameData)); |
3484 } else { | 3484 } else { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3517 0x00, 0x00, 0x00, 0x1C, | 3517 0x00, 0x00, 0x00, 0x1C, |
3518 0x00, 0x00, 0x00, 0x03, | 3518 0x00, 0x00, 0x00, 0x03, |
3519 0x00, 0x00, 0x00, 0x02, // 1st Setting | 3519 0x00, 0x00, 0x00, 0x02, // 1st Setting |
3520 0x00, 0x00, 0x00, 0x02, | 3520 0x00, 0x00, 0x00, 0x02, |
3521 0x00, 0x00, 0x00, 0x01, // 2nd (out of order) Setting | 3521 0x00, 0x00, 0x00, 0x01, // 2nd (out of order) Setting |
3522 0x00, 0x00, 0x00, 0x03, | 3522 0x00, 0x00, 0x00, 0x03, |
3523 0x00, 0x00, 0x01, 0x03, // 3rd (unprocessed) Setting | 3523 0x00, 0x00, 0x01, 0x03, // 3rd (unprocessed) Setting |
3524 0x00, 0x00, 0x00, 0x03, | 3524 0x00, 0x00, 0x00, 0x03, |
3525 }; | 3525 }; |
3526 const unsigned char kV4FrameData[] = { | 3526 const unsigned char kV4FrameData[] = { |
3527 0x00, 0x0f, 0x04, 0x00, | 3527 0x00, 0x12, 0x04, 0x00, |
3528 0x00, 0x00, 0x00, 0x00, | 3528 0x00, 0x00, 0x00, 0x00, |
3529 0x02, // 1st Setting | 3529 0x00, 0x02, // 1st Setting |
3530 0x00, 0x00, 0x00, 0x02, | 3530 0x00, 0x00, 0x00, 0x02, |
3531 0x01, // 2nd (out of order) Setting | 3531 0x00, 0x01, // 2nd (out of order) Setting |
3532 0x00, 0x00, 0x00, 0x03, | 3532 0x00, 0x00, 0x00, 0x03, |
3533 0x03, // 3rd (unprocessed) Setting | 3533 0x00, 0x03, // 3rd (unprocessed) Setting |
3534 0x00, 0x00, 0x00, 0x03, | 3534 0x00, 0x00, 0x00, 0x03, |
3535 }; | 3535 }; |
3536 | 3536 |
3537 TestSpdyVisitor visitor(spdy_version_); | 3537 TestSpdyVisitor visitor(spdy_version_); |
3538 visitor.use_compression_ = false; | 3538 visitor.use_compression_ = false; |
3539 if (IsSpdy2()) { | 3539 if (IsSpdy2()) { |
3540 visitor.SimulateInFramer(kV2FrameData, sizeof(kV2FrameData)); | 3540 visitor.SimulateInFramer(kV2FrameData, sizeof(kV2FrameData)); |
3541 } else if (IsSpdy3()) { | 3541 } else if (IsSpdy3()) { |
3542 visitor.SimulateInFramer(kV3FrameData, sizeof(kV3FrameData)); | 3542 visitor.SimulateInFramer(kV3FrameData, sizeof(kV3FrameData)); |
3543 } else { | 3543 } else { |
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5363 EXPECT_EQ(4u, framer.MapWeightToPriority(109)); | 5363 EXPECT_EQ(4u, framer.MapWeightToPriority(109)); |
5364 EXPECT_EQ(4u, framer.MapWeightToPriority(74)); | 5364 EXPECT_EQ(4u, framer.MapWeightToPriority(74)); |
5365 EXPECT_EQ(5u, framer.MapWeightToPriority(73)); | 5365 EXPECT_EQ(5u, framer.MapWeightToPriority(73)); |
5366 EXPECT_EQ(5u, framer.MapWeightToPriority(37)); | 5366 EXPECT_EQ(5u, framer.MapWeightToPriority(37)); |
5367 EXPECT_EQ(6u, framer.MapWeightToPriority(36)); | 5367 EXPECT_EQ(6u, framer.MapWeightToPriority(36)); |
5368 EXPECT_EQ(6u, framer.MapWeightToPriority(1)); | 5368 EXPECT_EQ(6u, framer.MapWeightToPriority(1)); |
5369 EXPECT_EQ(7u, framer.MapWeightToPriority(0)); | 5369 EXPECT_EQ(7u, framer.MapWeightToPriority(0)); |
5370 } | 5370 } |
5371 | 5371 |
5372 } // namespace net | 5372 } // namespace net |
OLD | NEW |