| 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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 'h', 'e', 'l', 'l', | 1631 'h', 'e', 'l', 'l', |
| 1632 'o' | 1632 'o' |
| 1633 }; | 1633 }; |
| 1634 | 1634 |
| 1635 const unsigned char kV4FrameData[] = { | 1635 const unsigned char kV4FrameData[] = { |
| 1636 0x00, 0x00, 0xfd, 0x00, // Length = 253. PADDED set. | 1636 0x00, 0x00, 0xfd, 0x00, // Length = 253. PADDED set. |
| 1637 0x08, 0x00, 0x00, 0x00, | 1637 0x08, 0x00, 0x00, 0x00, |
| 1638 0x01, 0xf7, // Pad length field. | 1638 0x01, 0xf7, // Pad length field. |
| 1639 'h', 'e', 'l', 'l', // Data | 1639 'h', 'e', 'l', 'l', // Data |
| 1640 'o', | 1640 'o', |
| 1641 // Padding of 247 zeros. | 1641 // Padding of 247 0x00(s). |
| 1642 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1642 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1643 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1643 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1644 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1644 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1645 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1645 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1646 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1646 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1647 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1647 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1648 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1648 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1649 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1649 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1650 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1650 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1651 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1651 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1652 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1652 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1653 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1653 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1654 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1654 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1655 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1655 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1656 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1656 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1657 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1657 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1658 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1658 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1659 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1659 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1660 '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', | 1660 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1661 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1662 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1661 }; | 1663 }; |
| 1662 const char bytes[] = "hello"; | 1664 const char bytes[] = "hello"; |
| 1663 | 1665 |
| 1664 SpdyDataIR data_ir(1, StringPiece(bytes, strlen(bytes))); | 1666 SpdyDataIR data_ir(1, StringPiece(bytes, strlen(bytes))); |
| 1665 // 247 zeros and the pad length field make the overall padding to be 248 | 1667 // 247 zeros and the pad length field make the overall padding to be 248 |
| 1666 // bytes. | 1668 // bytes. |
| 1667 data_ir.set_padding_len(248); | 1669 data_ir.set_padding_len(248); |
| 1668 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); | 1670 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); |
| 1669 if (IsSpdy4()) { | 1671 if (IsSpdy4()) { |
| 1670 CompareFrame( | 1672 CompareFrame( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1691 'h', 'e', 'l', 'l', | 1693 'h', 'e', 'l', 'l', |
| 1692 'o' | 1694 'o' |
| 1693 }; | 1695 }; |
| 1694 | 1696 |
| 1695 const unsigned char kV4FrameData[] = { | 1697 const unsigned char kV4FrameData[] = { |
| 1696 0x00, 0x00, 0x0d, 0x00, // Length = 13. PADDED set. | 1698 0x00, 0x00, 0x0d, 0x00, // Length = 13. PADDED set. |
| 1697 0x08, 0x00, 0x00, 0x00, | 1699 0x08, 0x00, 0x00, 0x00, |
| 1698 0x01, 0x07, // Pad length field. | 1700 0x01, 0x07, // Pad length field. |
| 1699 'h', 'e', 'l', 'l', // Data | 1701 'h', 'e', 'l', 'l', // Data |
| 1700 'o', | 1702 'o', |
| 1701 '0', '0', '0', '0', // Padding | 1703 0x00, 0x00, 0x00, 0x00, // Padding |
| 1702 '0', '0', '0' | 1704 0x00, 0x00, 0x00 |
| 1703 }; | 1705 }; |
| 1704 const char bytes[] = "hello"; | 1706 const char bytes[] = "hello"; |
| 1705 | 1707 |
| 1706 SpdyDataIR data_ir(1, StringPiece(bytes, strlen(bytes))); | 1708 SpdyDataIR data_ir(1, StringPiece(bytes, strlen(bytes))); |
| 1707 // 7 zeros and the pad length field make the overall padding to be 8 bytes. | 1709 // 7 zeros and the pad length field make the overall padding to be 8 bytes. |
| 1708 data_ir.set_padding_len(8); | 1710 data_ir.set_padding_len(8); |
| 1709 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); | 1711 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); |
| 1710 if (IsSpdy4()) { | 1712 if (IsSpdy4()) { |
| 1711 CompareFrame( | 1713 CompareFrame( |
| 1712 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); | 1714 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); |
| (...skipping 3836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5549 TestSpdyVisitor visitor(spdy_version_); | 5551 TestSpdyVisitor visitor(spdy_version_); |
| 5550 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData)); | 5552 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData)); |
| 5551 | 5553 |
| 5552 EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state()); | 5554 EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state()); |
| 5553 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, | 5555 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, |
| 5554 visitor.framer_.error_code()) | 5556 visitor.framer_.error_code()) |
| 5555 << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code()); | 5557 << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code()); |
| 5556 } | 5558 } |
| 5557 | 5559 |
| 5558 } // namespace net | 5560 } // namespace net |
| OLD | NEW |