| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "net/spdy/spdy_framer.h" | 9 #include "net/spdy/spdy_framer.h" |
| 10 #include "net/spdy/spdy_protocol.h" | 10 #include "net/spdy/spdy_protocol.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 DCHECK(parsed_headers); | 135 DCHECK(parsed_headers); |
| 136 headers_frame_count_++; | 136 headers_frame_count_++; |
| 137 break; | 137 break; |
| 138 default: | 138 default: |
| 139 DCHECK(false); // Error! | 139 DCHECK(false); // Error! |
| 140 } | 140 } |
| 141 if (frame->flags() & CONTROL_FLAG_FIN) | 141 if (frame->flags() & CONTROL_FLAG_FIN) |
| 142 ++fin_flag_count_; | 142 ++fin_flag_count_; |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool OnControlFrameHeaderData(SpdyStreamId stream_id, |
| 146 const char* header_data, |
| 147 size_t len) { |
| 148 DCHECK(false); |
| 149 return false; |
| 150 } |
| 151 |
| 152 void OnDataFrameHeader(const SpdyDataFrame* frame) { |
| 153 DCHECK(false); |
| 154 } |
| 155 |
| 145 // Convenience function which runs a framer simulation with particular input. | 156 // Convenience function which runs a framer simulation with particular input. |
| 146 void SimulateInFramer(const unsigned char* input, size_t size) { | 157 void SimulateInFramer(const unsigned char* input, size_t size) { |
| 147 framer_.set_enable_compression(false); | 158 framer_.set_enable_compression(false); |
| 148 framer_.set_visitor(this); | 159 framer_.set_visitor(this); |
| 149 size_t input_remaining = size; | 160 size_t input_remaining = size; |
| 150 const char* input_ptr = reinterpret_cast<const char*>(input); | 161 const char* input_ptr = reinterpret_cast<const char*>(input); |
| 151 while (input_remaining > 0 && | 162 while (input_remaining > 0 && |
| 152 framer_.error_code() == SpdyFramer::SPDY_NO_ERROR) { | 163 framer_.error_code() == SpdyFramer::SPDY_NO_ERROR) { |
| 153 // To make the tests more interesting, we feed random (amd small) chunks | 164 // To make the tests more interesting, we feed random (amd small) chunks |
| 154 // into the framer. This simulates getting strange-sized reads from | 165 // into the framer. This simulates getting strange-sized reads from |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 // to make sure we don't crash. | 1387 // to make sure we don't crash. |
| 1377 if (frame.get() != NULL) { | 1388 if (frame.get() != NULL) { |
| 1378 // Now that same header block should decompress just fine. | 1389 // Now that same header block should decompress just fine. |
| 1379 SpdyHeaderBlock new_headers; | 1390 SpdyHeaderBlock new_headers; |
| 1380 decompress_framer.ParseHeaderBlock(frame.get(), &new_headers); | 1391 decompress_framer.ParseHeaderBlock(frame.get(), &new_headers); |
| 1381 } | 1392 } |
| 1382 } | 1393 } |
| 1383 } | 1394 } |
| 1384 | 1395 |
| 1385 } // namespace | 1396 } // namespace |
| OLD | NEW |