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_test_utils.h" | 5 #include "net/spdy/spdy_test_utils.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 case 3: | 103 case 3: |
104 CHECK_EQ(0u, length & ~kLengthMask); | 104 CHECK_EQ(0u, length & ~kLengthMask); |
105 { | 105 { |
106 int32 wire_length = base::HostToNet32(length); | 106 int32 wire_length = base::HostToNet32(length); |
107 // The length field in SPDY 2 and 3 is a 24-bit (3B) integer starting at | 107 // The length field in SPDY 2 and 3 is a 24-bit (3B) integer starting at |
108 // offset 5. | 108 // offset 5. |
109 memcpy(frame->data() + 5, reinterpret_cast<char*>(&wire_length) + 1, 3); | 109 memcpy(frame->data() + 5, reinterpret_cast<char*>(&wire_length) + 1, 3); |
110 } | 110 } |
111 break; | 111 break; |
112 case 4: | 112 case 4: |
113 CHECK_GT(1u<<16, length); | 113 CHECK_GT(1u<<14, length); |
114 { | 114 { |
115 int32 wire_length = base::HostToNet16(static_cast<uint16>(length)); | 115 int32 wire_length = base::HostToNet16(static_cast<uint16>(length)); |
116 memcpy(frame->data(), | 116 memcpy(frame->data(), |
117 reinterpret_cast<char*>(&wire_length), | 117 reinterpret_cast<char*>(&wire_length), |
118 sizeof(uint16)); | 118 sizeof(uint16)); |
119 } | 119 } |
120 break; | 120 break; |
121 default: | 121 default: |
122 LOG(FATAL) << "Unsupported SPDY version."; | 122 LOG(FATAL) << "Unsupported SPDY version."; |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 | 126 |
127 } // namespace test | 127 } // namespace test |
128 | 128 |
129 } // namespace net | 129 } // namespace net |
OLD | NEW |