Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: net/spdy/spdy_framer_test.cc

Issue 1132423003: Fix redundant string conversions in SpdyFramerTests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 'o' 1597 'o'
1598 }; 1598 };
1599 const unsigned char kV4FrameData[] = { 1599 const unsigned char kV4FrameData[] = {
1600 0x00, 0x00, 0x05, 0x00, 1600 0x00, 0x00, 0x05, 0x00,
1601 0x00, 0x00, 0x00, 0x00, 1601 0x00, 0x00, 0x00, 0x00,
1602 0x01, 'h', 'e', 'l', 1602 0x01, 'h', 'e', 'l',
1603 'l', 'o' 1603 'l', 'o'
1604 }; 1604 };
1605 const char bytes[] = "hello"; 1605 const char bytes[] = "hello";
1606 1606
1607 SpdyDataIR data_ir(1, StringPiece(bytes, strlen(bytes))); 1607 SpdyDataIR data_ir(1, bytes);
1608 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); 1608 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
1609 if (IsSpdy4()) { 1609 if (IsSpdy4()) {
1610 CompareFrame( 1610 CompareFrame(
1611 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); 1611 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
1612 } else { 1612 } else {
1613 CompareFrame( 1613 CompareFrame(
1614 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData)); 1614 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
1615 } 1615 }
1616 1616
1617 SpdyDataIR data_header_ir(1); 1617 SpdyDataIR data_header_ir(1);
1618 data_header_ir.SetDataShallow(base::StringPiece(bytes, strlen(bytes))); 1618 data_header_ir.SetDataShallow(bytes);
1619 frame.reset(framer.SerializeDataFrameHeaderWithPaddingLengthField( 1619 frame.reset(framer.SerializeDataFrameHeaderWithPaddingLengthField(
1620 data_header_ir)); 1620 data_header_ir));
1621 CompareCharArraysWithHexError( 1621 CompareCharArraysWithHexError(
1622 kDescription, 1622 kDescription,
1623 reinterpret_cast<const unsigned char*>(frame->data()), 1623 reinterpret_cast<const unsigned char*>(frame->data()),
1624 framer.GetDataFrameMinimumSize(), 1624 framer.GetDataFrameMinimumSize(),
1625 IsSpdy4() ? kV4FrameData : kV3FrameData, 1625 IsSpdy4() ? kV4FrameData : kV3FrameData,
1626 framer.GetDataFrameMinimumSize()); 1626 framer.GetDataFrameMinimumSize());
1627 } 1627 }
1628 1628
(...skipping 30 matching lines...) Expand all
1659 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1659 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1660 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 1661 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1662 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1662 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1663 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1663 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1664 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1664 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1665 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1665 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1666 }; 1666 };
1667 const char bytes[] = "hello"; 1667 const char bytes[] = "hello";
1668 1668
1669 SpdyDataIR data_ir(1, StringPiece(bytes, strlen(bytes))); 1669 SpdyDataIR data_ir(1, bytes);
1670 // 247 zeros and the pad length field make the overall padding to be 248 1670 // 247 zeros and the pad length field make the overall padding to be 248
1671 // bytes. 1671 // bytes.
1672 data_ir.set_padding_len(248); 1672 data_ir.set_padding_len(248);
1673 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); 1673 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
1674 if (IsSpdy4()) { 1674 if (IsSpdy4()) {
1675 CompareFrame( 1675 CompareFrame(
1676 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); 1676 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
1677 } else { 1677 } else {
1678 CompareFrame( 1678 CompareFrame(
1679 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData)); 1679 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
(...skipping 21 matching lines...) Expand all
1701 0x00, 0x00, 0x0d, 0x00, // Length = 13. PADDED set. 1701 0x00, 0x00, 0x0d, 0x00, // Length = 13. PADDED set.
1702 0x08, 0x00, 0x00, 0x00, 1702 0x08, 0x00, 0x00, 0x00,
1703 0x01, 0x07, // Pad length field. 1703 0x01, 0x07, // Pad length field.
1704 'h', 'e', 'l', 'l', // Data 1704 'h', 'e', 'l', 'l', // Data
1705 'o', 1705 'o',
1706 0x00, 0x00, 0x00, 0x00, // Padding 1706 0x00, 0x00, 0x00, 0x00, // Padding
1707 0x00, 0x00, 0x00 1707 0x00, 0x00, 0x00
1708 }; 1708 };
1709 const char bytes[] = "hello"; 1709 const char bytes[] = "hello";
1710 1710
1711 SpdyDataIR data_ir(1, StringPiece(bytes, strlen(bytes))); 1711 SpdyDataIR data_ir(1, bytes);
1712 // 7 zeros and the pad length field make the overall padding to be 8 bytes. 1712 // 7 zeros and the pad length field make the overall padding to be 8 bytes.
1713 data_ir.set_padding_len(8); 1713 data_ir.set_padding_len(8);
1714 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); 1714 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
1715 if (IsSpdy4()) { 1715 if (IsSpdy4()) {
1716 CompareFrame( 1716 CompareFrame(
1717 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); 1717 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
1718 } else { 1718 } else {
1719 CompareFrame( 1719 CompareFrame(
1720 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData)); 1720 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
1721 } 1721 }
(...skipping 11 matching lines...) Expand all
1733 1733
1734 const unsigned char kV4FrameData[] = { 1734 const unsigned char kV4FrameData[] = {
1735 0x00, 0x00, 0x06, 0x00, // Length = 6. PADDED set. 1735 0x00, 0x00, 0x06, 0x00, // Length = 6. PADDED set.
1736 0x08, 0x00, 0x00, 0x00, 1736 0x08, 0x00, 0x00, 0x00,
1737 0x01, 0x00, // Pad length field. 1737 0x01, 0x00, // Pad length field.
1738 'h', 'e', 'l', 'l', // Data 1738 'h', 'e', 'l', 'l', // Data
1739 'o', 1739 'o',
1740 }; 1740 };
1741 const char bytes[] = "hello"; 1741 const char bytes[] = "hello";
1742 1742
1743 SpdyDataIR data_ir(1, StringPiece(bytes, strlen(bytes))); 1743 SpdyDataIR data_ir(1, bytes);
1744 // The pad length field itself is used for the 1-byte padding and no padding 1744 // The pad length field itself is used for the 1-byte padding and no padding
1745 // payload is needed. 1745 // payload is needed.
1746 data_ir.set_padding_len(1); 1746 data_ir.set_padding_len(1);
1747 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); 1747 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
1748 if (IsSpdy4()) { 1748 if (IsSpdy4()) {
1749 CompareFrame( 1749 CompareFrame(
1750 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); 1750 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
1751 } else { 1751 } else {
1752 CompareFrame( 1752 CompareFrame(
1753 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData)); 1753 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
(...skipping 13 matching lines...) Expand all
1767 const unsigned char kV3FrameData[] = { // Also applies for V2. 1767 const unsigned char kV3FrameData[] = { // Also applies for V2.
1768 0x00, 0x00, 0x00, 0x01, 1768 0x00, 0x00, 0x00, 0x01,
1769 0x00, 0x00, 0x00, 0x01, 1769 0x00, 0x00, 0x00, 0x01,
1770 0xff 1770 0xff
1771 }; 1771 };
1772 const unsigned char kV4FrameData[] = { 1772 const unsigned char kV4FrameData[] = {
1773 0x00, 0x00, 0x01, 0x00, 0x00, 1773 0x00, 0x00, 0x01, 0x00, 0x00,
1774 0x00, 0x00, 0x00, 0x01, 1774 0x00, 0x00, 0x00, 0x01,
1775 0xff 1775 0xff
1776 }; 1776 };
1777 SpdyDataIR data_ir(1, StringPiece("\xff", 1)); 1777 SpdyDataIR data_ir(1, "\xff");
1778 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); 1778 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
1779 if (IsSpdy4()) { 1779 if (IsSpdy4()) {
1780 CompareFrame( 1780 CompareFrame(
1781 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); 1781 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
1782 } else { 1782 } else {
1783 CompareFrame( 1783 CompareFrame(
1784 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData)); 1784 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
1785 } 1785 }
1786 } 1786 }
1787 1787
1788 { 1788 {
1789 const char kDescription[] = "'hello' data frame, with FIN"; 1789 const char kDescription[] = "'hello' data frame, with FIN";
1790 const unsigned char kV3FrameData[] = { // Also applies for V2. 1790 const unsigned char kV3FrameData[] = { // Also applies for V2.
1791 0x00, 0x00, 0x00, 0x01, 1791 0x00, 0x00, 0x00, 0x01,
1792 0x01, 0x00, 0x00, 0x05, 1792 0x01, 0x00, 0x00, 0x05,
1793 'h', 'e', 'l', 'l', 1793 'h', 'e', 'l', 'l',
1794 'o' 1794 'o'
1795 }; 1795 };
1796 const unsigned char kV4FrameData[] = { 1796 const unsigned char kV4FrameData[] = {
1797 0x00, 0x00, 0x05, 0x00, 1797 0x00, 0x00, 0x05, 0x00,
1798 0x01, 0x00, 0x00, 0x00, 1798 0x01, 0x00, 0x00, 0x00,
1799 0x01, 'h', 'e', 'l', 1799 0x01, 'h', 'e', 'l',
1800 'l', 'o' 1800 'l', 'o'
1801 }; 1801 };
1802 SpdyDataIR data_ir(1, StringPiece("hello", 5)); 1802 SpdyDataIR data_ir(1, "hello");
1803 data_ir.set_fin(true); 1803 data_ir.set_fin(true);
1804 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); 1804 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
1805 if (IsSpdy4()) { 1805 if (IsSpdy4()) {
1806 CompareFrame( 1806 CompareFrame(
1807 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); 1807 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
1808 } else { 1808 } else {
1809 CompareFrame( 1809 CompareFrame(
1810 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData)); 1810 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
1811 } 1811 }
1812 } 1812 }
1813 1813
1814 { 1814 {
1815 const char kDescription[] = "Empty data frame"; 1815 const char kDescription[] = "Empty data frame";
1816 const unsigned char kV3FrameData[] = { // Also applies for V2. 1816 const unsigned char kV3FrameData[] = { // Also applies for V2.
1817 0x00, 0x00, 0x00, 0x01, 1817 0x00, 0x00, 0x00, 0x01,
1818 0x00, 0x00, 0x00, 0x00, 1818 0x00, 0x00, 0x00, 0x00,
1819 }; 1819 };
1820 const unsigned char kV4FrameData[] = { 1820 const unsigned char kV4FrameData[] = {
1821 0x00, 0x00, 0x00, 0x00, 1821 0x00, 0x00, 0x00, 0x00,
1822 0x00, 0x00, 0x00, 0x00, 1822 0x00, 0x00, 0x00, 0x00,
1823 0x01, 1823 0x01,
1824 }; 1824 };
1825 SpdyDataIR data_ir(1, StringPiece()); 1825 SpdyDataIR data_ir(1, "");
1826 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); 1826 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
1827 if (IsSpdy4()) { 1827 if (IsSpdy4()) {
1828 CompareFrame( 1828 CompareFrame(
1829 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); 1829 kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
1830 } else { 1830 } else {
1831 CompareFrame( 1831 CompareFrame(
1832 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData)); 1832 kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
1833 } 1833 }
1834 1834
1835 frame.reset(framer.SerializeDataFrameHeaderWithPaddingLengthField(data_ir)); 1835 frame.reset(framer.SerializeDataFrameHeaderWithPaddingLengthField(data_ir));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 0x00, 0x00, 0x00, 0x01, 1877 0x00, 0x00, 0x00, 0x01,
1878 0x01, 0x40, 0x00, 0x00, 1878 0x01, 0x40, 0x00, 0x00,
1879 }; 1879 };
1880 1880
1881 const int kFrameSize = arraysize(kFrameHeader) + kDataSize; 1881 const int kFrameSize = arraysize(kFrameHeader) + kDataSize;
1882 scoped_ptr<unsigned char[]> expected_frame_data( 1882 scoped_ptr<unsigned char[]> expected_frame_data(
1883 new unsigned char[kFrameSize]); 1883 new unsigned char[kFrameSize]);
1884 memcpy(expected_frame_data.get(), kFrameHeader, arraysize(kFrameHeader)); 1884 memcpy(expected_frame_data.get(), kFrameHeader, arraysize(kFrameHeader));
1885 memset(expected_frame_data.get() + arraysize(kFrameHeader), 'A', kDataSize); 1885 memset(expected_frame_data.get() + arraysize(kFrameHeader), 'A', kDataSize);
1886 1886
1887 SpdyDataIR data_ir(1, StringPiece(kData.data(), kData.size())); 1887 SpdyDataIR data_ir(1, kData);
1888 data_ir.set_fin(true); 1888 data_ir.set_fin(true);
1889 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); 1889 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
1890 CompareFrame(kDescription, *frame, expected_frame_data.get(), kFrameSize); 1890 CompareFrame(kDescription, *frame, expected_frame_data.get(), kFrameSize);
1891 } 1891 }
1892 } 1892 }
1893 1893
1894 TEST_P(SpdyFramerTest, CreateSynStreamUncompressed) { 1894 TEST_P(SpdyFramerTest, CreateSynStreamUncompressed) {
1895 if (!IsSpdy2() && !IsSpdy3()) { 1895 if (!IsSpdy2() && !IsSpdy3()) {
1896 // SYN_STREAM unsupported in SPDY>3 1896 // SYN_STREAM unsupported in SPDY>3
1897 return; 1897 return;
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after
4109 return; 4109 return;
4110 } 4110 }
4111 4111
4112 const int kPaddingLen = 119; 4112 const int kPaddingLen = 119;
4113 const char data_payload[] = "hello"; 4113 const char data_payload[] = "hello";
4114 4114
4115 testing::StrictMock<test::MockSpdyFramerVisitor> visitor; 4115 testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
4116 SpdyFramer framer(spdy_version_); 4116 SpdyFramer framer(spdy_version_);
4117 framer.set_visitor(&visitor); 4117 framer.set_visitor(&visitor);
4118 4118
4119 SpdyDataIR data_ir(1, StringPiece(data_payload, strlen(data_payload))); 4119 SpdyDataIR data_ir(1, data_payload);
4120 data_ir.set_padding_len(kPaddingLen); 4120 data_ir.set_padding_len(kPaddingLen);
4121 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); 4121 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
4122 ASSERT_TRUE(frame.get() != NULL); 4122 ASSERT_TRUE(frame.get() != NULL);
4123 4123
4124 int bytes_consumed = 0; 4124 int bytes_consumed = 0;
4125 4125
4126 // Send the frame header. 4126 // Send the frame header.
4127 EXPECT_CALL(visitor, OnDataFrameHeader(1, 4127 EXPECT_CALL(visitor, OnDataFrameHeader(1,
4128 kPaddingLen + strlen(data_payload), 4128 kPaddingLen + strlen(data_payload),
4129 false)); 4129 false));
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
4881 } 4881 }
4882 4882
4883 uint8 flags = 0; 4883 uint8 flags = 0;
4884 do { 4884 do {
4885 SCOPED_TRACE(testing::Message() << "Flags " << flags); 4885 SCOPED_TRACE(testing::Message() << "Flags " << flags);
4886 4886
4887 testing::StrictMock<test::MockSpdyFramerVisitor> visitor; 4887 testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
4888 SpdyFramer framer(spdy_version_); 4888 SpdyFramer framer(spdy_version_);
4889 framer.set_visitor(&visitor); 4889 framer.set_visitor(&visitor);
4890 4890
4891 SpdyDataIR data_ir(1, StringPiece("hello", 5)); 4891 SpdyDataIR data_ir(1, "hello");
4892 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); 4892 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
4893 SetFrameFlags(frame.get(), flags, spdy_version_); 4893 SetFrameFlags(frame.get(), flags, spdy_version_);
4894 4894
4895 if (flags & ~DATA_FLAG_FIN) { 4895 if (flags & ~DATA_FLAG_FIN) {
4896 EXPECT_CALL(visitor, OnError(_)); 4896 EXPECT_CALL(visitor, OnError(_));
4897 } else { 4897 } else {
4898 EXPECT_CALL(visitor, OnDataFrameHeader(1, 5, flags & DATA_FLAG_FIN)); 4898 EXPECT_CALL(visitor, OnDataFrameHeader(1, 5, flags & DATA_FLAG_FIN));
4899 EXPECT_CALL(visitor, OnStreamFrameData(_, _, 5, false)); 4899 EXPECT_CALL(visitor, OnStreamFrameData(_, _, 5, false));
4900 if (flags & DATA_FLAG_FIN) { 4900 if (flags & DATA_FLAG_FIN) {
4901 EXPECT_CALL(visitor, OnStreamFrameData(_, _, 0, true)); 4901 EXPECT_CALL(visitor, OnStreamFrameData(_, _, 0, true));
(...skipping 23 matching lines...) Expand all
4925 DATA_FLAG_PADDED; 4925 DATA_FLAG_PADDED;
4926 4926
4927 uint8 flags = 0; 4927 uint8 flags = 0;
4928 do { 4928 do {
4929 SCOPED_TRACE(testing::Message() << "Flags " << flags); 4929 SCOPED_TRACE(testing::Message() << "Flags " << flags);
4930 4930
4931 testing::StrictMock<test::MockSpdyFramerVisitor> visitor; 4931 testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
4932 SpdyFramer framer(spdy_version_); 4932 SpdyFramer framer(spdy_version_);
4933 framer.set_visitor(&visitor); 4933 framer.set_visitor(&visitor);
4934 4934
4935 SpdyDataIR data_ir(1, StringPiece("hello", 5)); 4935 SpdyDataIR data_ir(1, "hello");
4936 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir)); 4936 scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
4937 SetFrameFlags(frame.get(), flags, spdy_version_); 4937 SetFrameFlags(frame.get(), flags, spdy_version_);
4938 4938
4939 if (flags & ~valid_data_flags) { 4939 if (flags & ~valid_data_flags) {
4940 EXPECT_CALL(visitor, OnError(_)); 4940 EXPECT_CALL(visitor, OnError(_));
4941 } else { 4941 } else {
4942 EXPECT_CALL(visitor, OnDataFrameHeader(1, 5, flags & DATA_FLAG_FIN)); 4942 EXPECT_CALL(visitor, OnDataFrameHeader(1, 5, flags & DATA_FLAG_FIN));
4943 if (flags & DATA_FLAG_PADDED) { 4943 if (flags & DATA_FLAG_PADDED) {
4944 // The first byte of payload is parsed as padding length. 4944 // The first byte of payload is parsed as padding length.
4945 EXPECT_CALL(visitor, OnStreamPadding(_, 1)); 4945 EXPECT_CALL(visitor, OnStreamPadding(_, 1));
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
5983 TestSpdyVisitor visitor(spdy_version_); 5983 TestSpdyVisitor visitor(spdy_version_);
5984 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData)); 5984 visitor.SimulateInFramer(kFrameData, sizeof(kFrameData));
5985 5985
5986 EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state()); 5986 EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state());
5987 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, 5987 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME,
5988 visitor.framer_.error_code()) 5988 visitor.framer_.error_code())
5989 << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code()); 5989 << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code());
5990 } 5990 }
5991 5991
5992 } // namespace net 5992 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698