Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Side by Side Diff: net/spdy/spdy_framer_test.cc

Issue 2438163002: Remove SpdyFramerVisitorInterface::OnControlFrameHeaderData(). (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_framer_decoder_adapter.cc ('k') | net/spdy/spdy_no_op_visitor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 size_t len) override { 158 size_t len) override {
159 LOG(FATAL); 159 LOG(FATAL);
160 } 160 }
161 161
162 void OnStreamEnd(SpdyStreamId stream_id) override { LOG(FATAL); } 162 void OnStreamEnd(SpdyStreamId stream_id) override { LOG(FATAL); }
163 163
164 void OnStreamPadding(SpdyStreamId stream_id, size_t len) override { 164 void OnStreamPadding(SpdyStreamId stream_id, size_t len) override {
165 LOG(FATAL); 165 LOG(FATAL);
166 } 166 }
167 167
168 bool OnControlFrameHeaderData(SpdyStreamId stream_id,
169 const char* header_data,
170 size_t len) override {
171 LOG(FATAL);
172 return true;
173 }
174
175 void OnRstStream(SpdyStreamId stream_id, 168 void OnRstStream(SpdyStreamId stream_id,
176 SpdyRstStreamStatus status) override { 169 SpdyRstStreamStatus status) override {
177 LOG(FATAL); 170 LOG(FATAL);
178 } 171 }
179 void OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) override { 172 void OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) override {
180 LOG(FATAL); 173 LOG(FATAL);
181 } 174 }
182 void OnPing(SpdyPingId unique_id, bool is_ack) override { LOG(FATAL); } 175 void OnPing(SpdyPingId unique_id, bool is_ack) override { LOG(FATAL); }
183 void OnSettingsEnd() override { LOG(FATAL); } 176 void OnSettingsEnd() override { LOG(FATAL); }
184 void OnGoAway(SpdyStreamId last_accepted_stream_id, 177 void OnGoAway(SpdyStreamId last_accepted_stream_id,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 377
385 void OnHeaderFrameEnd(SpdyStreamId stream_id, bool end_headers) override { 378 void OnHeaderFrameEnd(SpdyStreamId stream_id, bool end_headers) override {
386 CHECK(headers_handler_ != nullptr); 379 CHECK(headers_handler_ != nullptr);
387 headers_ = headers_handler_->decoded_block().Clone(); 380 headers_ = headers_handler_->decoded_block().Clone();
388 header_bytes_received_ = headers_handler_->header_bytes_parsed(); 381 header_bytes_received_ = headers_handler_->header_bytes_parsed();
389 if (end_headers) { 382 if (end_headers) {
390 headers_handler_.reset(); 383 headers_handler_.reset();
391 } 384 }
392 } 385 }
393 386
394 bool OnControlFrameHeaderData(SpdyStreamId stream_id,
395 const char* header_data,
396 size_t len) override {
397 VLOG(1) << "OnControlFrameHeaderData(" << stream_id << ", data, " << len
398 << ")";
399 ++control_frame_header_data_count_;
400 CHECK_EQ(header_stream_id_, stream_id);
401 if (len == 0) {
402 ++zero_length_control_frame_header_data_count_;
403 // Indicates end-of-header-block.
404 headers_.clear();
405 CHECK(header_buffer_valid_);
406 return framer_.ParseHeaderBlockInBuffer(header_buffer_.get(),
407 header_buffer_length_, &headers_);
408 }
409 const size_t available = header_buffer_size_ - header_buffer_length_;
410 if (len > available) {
411 header_buffer_valid_ = false;
412 return false;
413 }
414 memcpy(header_buffer_.get() + header_buffer_length_, header_data, len);
415 header_buffer_length_ += len;
416 return true;
417 }
418
419 void OnSynStream(SpdyStreamId stream_id, 387 void OnSynStream(SpdyStreamId stream_id,
420 SpdyStreamId associated_stream_id, 388 SpdyStreamId associated_stream_id,
421 SpdyPriority priority, 389 SpdyPriority priority,
422 bool fin, 390 bool fin,
423 bool unidirectional) override { 391 bool unidirectional) override {
424 VLOG(1) << "OnSynStream(" << stream_id << ", " << associated_stream_id 392 VLOG(1) << "OnSynStream(" << stream_id << ", " << associated_stream_id
425 << ", " << priority << ", " << (fin ? 1 : 0) << ", " 393 << ", " << priority << ", " << (fin ? 1 : 0) << ", "
426 << (unidirectional ? 1 : 0) << ")"; 394 << (unidirectional ? 1 : 0) << ")";
427 ++syn_frame_count_; 395 ++syn_frame_count_;
428 if (framer_.protocol_version() == SPDY3) { 396 if (framer_.protocol_version() == SPDY3) {
(...skipping 5995 matching lines...) Expand 10 before | Expand all | Expand 10 after
6424 6392
6425 EXPECT_EQ(1, visitor->data_frame_count_); 6393 EXPECT_EQ(1, visitor->data_frame_count_);
6426 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_)); 6394 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_));
6427 EXPECT_EQ(0, visitor->headers_frame_count_); 6395 EXPECT_EQ(0, visitor->headers_frame_count_);
6428 } 6396 }
6429 } 6397 }
6430 6398
6431 } // namespace test 6399 } // namespace test
6432 6400
6433 } // namespace net 6401 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer_decoder_adapter.cc ('k') | net/spdy/spdy_no_op_visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698