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 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); | 1819 CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); |
1820 } | 1820 } |
1821 } | 1821 } |
1822 | 1822 |
1823 { | 1823 { |
1824 const char kDescription[] = | 1824 const char kDescription[] = |
1825 "SYN_STREAM frame with a 0-length header name, highest pri, FIN, " | 1825 "SYN_STREAM frame with a 0-length header name, highest pri, FIN, " |
1826 "max stream ID"; | 1826 "max stream ID"; |
1827 | 1827 |
1828 SpdyHeaderBlock headers; | 1828 SpdyHeaderBlock headers; |
1829 headers[""] = "foo"; | 1829 headers[std::string()] = "foo"; |
1830 headers["foo"] = "bar"; | 1830 headers["foo"] = "bar"; |
1831 | 1831 |
1832 const unsigned char kV2FrameData[] = { | 1832 const unsigned char kV2FrameData[] = { |
1833 0x80, spdy_version_, 0x00, 0x01, | 1833 0x80, spdy_version_, 0x00, 0x01, |
1834 0x01, 0x00, 0x00, 0x1D, | 1834 0x01, 0x00, 0x00, 0x1D, |
1835 0x7f, 0xff, 0xff, 0xff, | 1835 0x7f, 0xff, 0xff, 0xff, |
1836 0x7f, 0xff, 0xff, 0xff, | 1836 0x7f, 0xff, 0xff, 0xff, |
1837 0x00, 0x00, 0x00, 0x02, | 1837 0x00, 0x00, 0x00, 0x02, |
1838 0x00, 0x00, 0x00, 0x03, | 1838 0x00, 0x00, 0x00, 0x03, |
1839 'f', 'o', 'o', 0x00, | 1839 'f', 'o', 'o', 0x00, |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 } else { | 2096 } else { |
2097 CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); | 2097 CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); |
2098 } | 2098 } |
2099 } | 2099 } |
2100 | 2100 |
2101 { | 2101 { |
2102 const char kDescription[] = | 2102 const char kDescription[] = |
2103 "SYN_REPLY frame with a 0-length header name, FIN, max stream ID"; | 2103 "SYN_REPLY frame with a 0-length header name, FIN, max stream ID"; |
2104 | 2104 |
2105 SpdyHeaderBlock headers; | 2105 SpdyHeaderBlock headers; |
2106 headers[""] = "foo"; | 2106 headers[std::string()] = "foo"; |
2107 headers["foo"] = "bar"; | 2107 headers["foo"] = "bar"; |
2108 | 2108 |
2109 const unsigned char kV2FrameData[] = { | 2109 const unsigned char kV2FrameData[] = { |
2110 0x80, spdy_version_, 0x00, 0x02, | 2110 0x80, spdy_version_, 0x00, 0x02, |
2111 0x01, 0x00, 0x00, 0x19, | 2111 0x01, 0x00, 0x00, 0x19, |
2112 0x7f, 0xff, 0xff, 0xff, | 2112 0x7f, 0xff, 0xff, 0xff, |
2113 0x00, 0x00, 0x00, 0x02, | 2113 0x00, 0x00, 0x00, 0x02, |
2114 0x00, 0x00, 0x00, 0x03, | 2114 0x00, 0x00, 0x00, 0x03, |
2115 'f', 'o', 'o', 0x00, | 2115 'f', 'o', 'o', 0x00, |
2116 0x03, 'f', 'o', 'o', | 2116 0x03, 'f', 'o', 'o', |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2612 } else { | 2612 } else { |
2613 CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); | 2613 CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); |
2614 } | 2614 } |
2615 } | 2615 } |
2616 | 2616 |
2617 { | 2617 { |
2618 const char kDescription[] = | 2618 const char kDescription[] = |
2619 "HEADERS frame with a 0-length header name, FIN, max stream ID"; | 2619 "HEADERS frame with a 0-length header name, FIN, max stream ID"; |
2620 | 2620 |
2621 SpdyHeaderBlock headers; | 2621 SpdyHeaderBlock headers; |
2622 headers[""] = "foo"; | 2622 headers[std::string()] = "foo"; |
2623 headers["foo"] = "bar"; | 2623 headers["foo"] = "bar"; |
2624 | 2624 |
2625 const unsigned char kV2FrameData[] = { | 2625 const unsigned char kV2FrameData[] = { |
2626 0x80, spdy_version_, 0x00, 0x08, | 2626 0x80, spdy_version_, 0x00, 0x08, |
2627 0x01, 0x00, 0x00, 0x19, | 2627 0x01, 0x00, 0x00, 0x19, |
2628 0x7f, 0xff, 0xff, 0xff, | 2628 0x7f, 0xff, 0xff, 0xff, |
2629 0x00, 0x00, 0x00, 0x02, | 2629 0x00, 0x00, 0x00, 0x02, |
2630 0x00, 0x00, 0x00, 0x03, | 2630 0x00, 0x00, 0x00, 0x03, |
2631 'f', 'o', 'o', 0x00, | 2631 'f', 'o', 'o', 0x00, |
2632 0x03, 'f', 'o', 'o', | 2632 0x03, 'f', 'o', 'o', |
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4131 arraysize(kV3FrameData)); | 4131 arraysize(kV3FrameData)); |
4132 } else { | 4132 } else { |
4133 framer.ProcessInput(reinterpret_cast<const char*>(kV4FrameData), | 4133 framer.ProcessInput(reinterpret_cast<const char*>(kV4FrameData), |
4134 arraysize(kV4FrameData)); | 4134 arraysize(kV4FrameData)); |
4135 } | 4135 } |
4136 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); | 4136 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); |
4137 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()); | 4137 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()); |
4138 } | 4138 } |
4139 | 4139 |
4140 } // namespace net | 4140 } // namespace net |
OLD | NEW |