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 "net/spdy/spdy_framer.h" | 5 #include "net/spdy/spdy_framer.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3525 if (spdy_version_ <= SPDY3) { | 3525 if (spdy_version_ <= SPDY3) { |
3526 return; | 3526 return; |
3527 } | 3527 } |
3528 | 3528 |
3529 SpdyFramer framer(spdy_version_); | 3529 SpdyFramer framer(spdy_version_); |
3530 | 3530 |
3531 const char kDescription[] = "ALTSVC frame"; | 3531 const char kDescription[] = "ALTSVC frame"; |
3532 const char kType = static_cast<unsigned char>( | 3532 const char kType = static_cast<unsigned char>( |
3533 SpdyConstants::SerializeFrameType(spdy_version_, ALTSVC)); | 3533 SpdyConstants::SerializeFrameType(spdy_version_, ALTSVC)); |
3534 const unsigned char kFrameData[] = { | 3534 const unsigned char kFrameData[] = { |
3535 0x00, 0x00, 0x49, kType, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, 'o', | 3535 0x00, 0x00, 0x4b, kType, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, 'o', |
3536 'r', 'i', 'g', 'i', 'n', 'p', 'i', 'd', '1', '=', '"', 'h', | 3536 'r', 'i', 'g', 'i', 'n', 'p', 'i', 'd', '1', '=', '"', 'h', |
3537 'o', 's', 't', ':', '4', '4', '3', '"', ';', ' ', 'm', 'a', | 3537 'o', 's', 't', ':', '4', '4', '3', '"', ';', ' ', 'm', 'a', |
3538 '=', '5', ',', 'p', '%', '2', '2', '%', '3', 'D', 'i', '%', | 3538 '=', '5', ',', 'p', '%', '2', '2', '%', '3', 'D', 'i', '%', |
3539 '3', 'A', 'd', '=', '"', 'h', '_', '\\', '\\', 'o', '\\', '"', | 3539 '3', 'A', 'd', '=', '"', 'h', '_', '\\', '\\', 'o', '\\', '"', |
3540 's', 't', ':', '1', '2', '3', '"', ';', ' ', 'm', 'a', '=', | 3540 's', 't', ':', '1', '2', '3', '"', ';', ' ', 'm', 'a', '=', |
3541 '4', '2', ';', ' ', 'p', '=', '0', '.', '2', '0', | 3541 '4', '2', ';', ' ', 'p', '=', '"', '0', '.', '2', '0', '"', |
3542 }; | 3542 }; |
3543 SpdyAltSvcIR altsvc_ir(3); | 3543 SpdyAltSvcIR altsvc_ir(3); |
3544 altsvc_ir.set_origin("origin"); | 3544 altsvc_ir.set_origin("origin"); |
3545 altsvc_ir.add_altsvc( | 3545 altsvc_ir.add_altsvc( |
3546 SpdyAltSvcWireFormat::AlternativeService("pid1", "host", 443, 5, 1.0)); | 3546 SpdyAltSvcWireFormat::AlternativeService("pid1", "host", 443, 5, 1.0)); |
3547 altsvc_ir.add_altsvc(SpdyAltSvcWireFormat::AlternativeService( | 3547 altsvc_ir.add_altsvc(SpdyAltSvcWireFormat::AlternativeService( |
3548 "p\"=i:d", "h_\\o\"st", 123, 42, 0.2)); | 3548 "p\"=i:d", "h_\\o\"st", 123, 42, 0.2)); |
3549 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(altsvc_ir)); | 3549 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(altsvc_ir)); |
3550 CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData)); | 3550 CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData)); |
3551 } | 3551 } |
(...skipping 2590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6142 | 6142 |
6143 EXPECT_EQ(1, visitor->data_frame_count_); | 6143 EXPECT_EQ(1, visitor->data_frame_count_); |
6144 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_)); | 6144 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_)); |
6145 EXPECT_EQ(0, visitor->headers_frame_count_); | 6145 EXPECT_EQ(0, visitor->headers_frame_count_); |
6146 } | 6146 } |
6147 } | 6147 } |
6148 | 6148 |
6149 } // namespace test | 6149 } // namespace test |
6150 | 6150 |
6151 } // namespace net | 6151 } // namespace net |
OLD | NEW |