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, 0x4f, kType, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, | 3535 0x00, 0x00, 0x51, kType, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, 'o', |
3536 'o', 'r', 'i', 'g', 'i', 'n', 'p', 'i', 'd', '1', '=', | 3536 'r', 'i', 'g', 'i', 'n', 'p', 'i', 'd', '1', '=', '"', 'h', |
3537 '"', 'h', 'o', 's', 't', ':', '4', '4', '3', '"', ';', | 3537 'o', 's', 't', ':', '4', '4', '3', '"', ';', ' ', 'm', 'a', |
3538 ' ', 'm', 'a', '=', '5', ',', 'p', '%', '2', '2', '%', | 3538 '=', '5', ',', 'p', '%', '2', '2', '%', '3', 'D', 'i', '%', |
3539 '3', 'D', 'i', '%', '3', 'A', 'd', '=', '"', 'h', '_', | 3539 '3', 'A', 'd', '=', '"', 'h', '_', '\\', '\\', 'o', '\\', '"', |
3540 '\\', '\\', 'o', '\\', '"', 's', 't', ':', '1', '2', '3', | 3540 's', 't', ':', '1', '2', '3', '"', ';', ' ', 'v', '=', '2', |
3541 '"', ';', ' ', 'v', '=', '2', '4', ';', ' ', 'm', 'a', | 3541 '4', ';', ' ', 'm', 'a', '=', '4', '2', ';', ' ', 'p', '=', |
3542 '=', '4', '2', ';', ' ', 'p', '=', '0', '.', '2', '0'}; | 3542 '"', '0', '.', '2', '0', '"'}; |
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, 0, 5, 1.0)); | 3546 SpdyAltSvcWireFormat::AlternativeService("pid1", "host", 443, 0, 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, 24, 42, 0.2)); | 3548 "p\"=i:d", "h_\\o\"st", 123, 24, 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 } |
3552 | 3552 |
(...skipping 2592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6145 | 6145 |
6146 EXPECT_EQ(1, visitor->data_frame_count_); | 6146 EXPECT_EQ(1, visitor->data_frame_count_); |
6147 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_)); | 6147 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_)); |
6148 EXPECT_EQ(0, visitor->headers_frame_count_); | 6148 EXPECT_EQ(0, visitor->headers_frame_count_); |
6149 } | 6149 } |
6150 } | 6150 } |
6151 | 6151 |
6152 } // namespace test | 6152 } // namespace test |
6153 | 6153 |
6154 } // namespace net | 6154 } // namespace net |
OLD | NEW |