| 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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 3); | 896 3); |
| 897 frame.WriteUInt32(framer.GetHighestPriority()); | 897 frame.WriteUInt32(framer.GetHighestPriority()); |
| 898 } | 898 } |
| 899 | 899 |
| 900 string value("value1\0value2", 13); | 900 string value("value1\0value2", 13); |
| 901 if (IsSpdy2()) { | 901 if (IsSpdy2()) { |
| 902 frame.WriteUInt16(1); // Number of headers. | 902 frame.WriteUInt16(1); // Number of headers. |
| 903 frame.WriteString("name"); | 903 frame.WriteString("name"); |
| 904 frame.WriteString(value); | 904 frame.WriteString(value); |
| 905 } else if (spdy_version_ > SPDY3) { | 905 } else if (spdy_version_ > SPDY3) { |
| 906 HpackOutputStream output_stream(1024); | 906 // TODO(jgraettinger): If this pattern appears again, move to test class. |
| 907 output_stream.AppendLiteralHeaderNoIndexingWithName("name", value); | 907 std::map<string, string> header_set; |
| 908 header_set["name"] = value; |
| 908 string buffer; | 909 string buffer; |
| 909 output_stream.TakeString(&buffer); | 910 HpackEncoder encoder; |
| 911 encoder.EncodeHeaderSet(header_set, &buffer); |
| 910 frame.WriteBytes(&buffer[0], buffer.size()); | 912 frame.WriteBytes(&buffer[0], buffer.size()); |
| 911 } else { | 913 } else { |
| 912 frame.WriteUInt32(1); // Number of headers. | 914 frame.WriteUInt32(1); // Number of headers. |
| 913 frame.WriteStringPiece32("name"); | 915 frame.WriteStringPiece32("name"); |
| 914 frame.WriteStringPiece32(value); | 916 frame.WriteStringPiece32(value); |
| 915 } | 917 } |
| 916 // write the length | 918 // write the length |
| 917 frame.RewriteLength(framer); | 919 frame.RewriteLength(framer); |
| 918 | 920 |
| 919 framer.set_enable_compression(false); | 921 framer.set_enable_compression(false); |
| (...skipping 4108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5028 SpdyBlockedIR blocked_ir(0); | 5030 SpdyBlockedIR blocked_ir(0); |
| 5029 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir)); | 5031 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir)); |
| 5030 framer.ProcessInput(frame->data(), framer.GetBlockedSize()); | 5032 framer.ProcessInput(frame->data(), framer.GetBlockedSize()); |
| 5031 | 5033 |
| 5032 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); | 5034 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); |
| 5033 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) | 5035 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) |
| 5034 << SpdyFramer::ErrorCodeToString(framer.error_code()); | 5036 << SpdyFramer::ErrorCodeToString(framer.error_code()); |
| 5035 } | 5037 } |
| 5036 | 5038 |
| 5037 } // namespace net | 5039 } // namespace net |
| OLD | NEW |