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

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

Issue 1461273003: Remove already obsolete CREDENTIAL frame from SPDY code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/buffered_spdy_framer.h ('k') | net/spdy/spdy_framer.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/buffered_spdy_framer.h" 5 #include "net/spdy/buffered_spdy_framer.h"
6 6
7 #include "net/spdy/spdy_test_util_common.h" 7 #include "net/spdy/spdy_test_util_common.h"
8 #include "testing/platform_test.h" 8 #include "testing/platform_test.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 void OnGoAway(SpdyStreamId last_accepted_stream_id, 112 void OnGoAway(SpdyStreamId last_accepted_stream_id,
113 SpdyGoAwayStatus status, 113 SpdyGoAwayStatus status,
114 StringPiece debug_data) override { 114 StringPiece debug_data) override {
115 goaway_count_++; 115 goaway_count_++;
116 goaway_last_accepted_stream_id_ = last_accepted_stream_id; 116 goaway_last_accepted_stream_id_ = last_accepted_stream_id;
117 goaway_status_ = status; 117 goaway_status_ = status;
118 goaway_debug_data_.assign(debug_data.data(), debug_data.size()); 118 goaway_debug_data_.assign(debug_data.data(), debug_data.size());
119 } 119 }
120 120
121 bool OnCredentialFrameData(const char*, size_t) {
122 LOG(FATAL) << "Unexpected OnCredentialFrameData call.";
123 return false;
124 }
125
126 void OnDataFrameHeader(const SpdyFrame* frame) { 121 void OnDataFrameHeader(const SpdyFrame* frame) {
127 LOG(FATAL) << "Unexpected OnDataFrameHeader call."; 122 LOG(FATAL) << "Unexpected OnDataFrameHeader call.";
128 } 123 }
129 124
130 void OnRstStream(const SpdyFrame& frame) {} 125 void OnRstStream(const SpdyFrame& frame) {}
131 void OnGoAway(const SpdyFrame& frame) {} 126 void OnGoAway(const SpdyFrame& frame) {}
132 void OnPing(const SpdyFrame& frame) {} 127 void OnPing(const SpdyFrame& frame) {}
133 void OnWindowUpdate(SpdyStreamId stream_id, int delta_window_size) override {} 128 void OnWindowUpdate(SpdyStreamId stream_id, int delta_window_size) override {}
134 129
135 void OnPushPromise(SpdyStreamId stream_id, 130 void OnPushPromise(SpdyStreamId stream_id,
136 SpdyStreamId promised_stream_id, 131 SpdyStreamId promised_stream_id,
137 const SpdyHeaderBlock& headers) override { 132 const SpdyHeaderBlock& headers) override {
138 header_stream_id_ = stream_id; 133 header_stream_id_ = stream_id;
139 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); 134 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream);
140 push_promise_frame_count_++; 135 push_promise_frame_count_++;
141 promised_stream_id_ = promised_stream_id; 136 promised_stream_id_ = promised_stream_id;
142 EXPECT_NE(promised_stream_id_, SpdyFramer::kInvalidStream); 137 EXPECT_NE(promised_stream_id_, SpdyFramer::kInvalidStream);
143 headers_ = headers; 138 headers_ = headers;
144 } 139 }
145 140
146 bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override { 141 bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override {
147 return true; 142 return true;
148 } 143 }
149 144
150 void OnCredential(const SpdyFrame& frame) {}
151
152 // Convenience function which runs a framer simulation with particular input. 145 // Convenience function which runs a framer simulation with particular input.
153 void SimulateInFramer(const unsigned char* input, size_t size) { 146 void SimulateInFramer(const unsigned char* input, size_t size) {
154 buffered_spdy_framer_.set_visitor(this); 147 buffered_spdy_framer_.set_visitor(this);
155 size_t input_remaining = size; 148 size_t input_remaining = size;
156 const char* input_ptr = reinterpret_cast<const char*>(input); 149 const char* input_ptr = reinterpret_cast<const char*>(input);
157 while (input_remaining > 0 && 150 while (input_remaining > 0 &&
158 buffered_spdy_framer_.error_code() == SpdyFramer::SPDY_NO_ERROR) { 151 buffered_spdy_framer_.error_code() == SpdyFramer::SPDY_NO_ERROR) {
159 // To make the tests more interesting, we feed random (amd small) chunks 152 // To make the tests more interesting, we feed random (amd small) chunks
160 // into the framer. This simulates getting strange-sized reads from 153 // into the framer. This simulates getting strange-sized reads from
161 // the socket. 154 // the socket.
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 reinterpret_cast<unsigned char*>(goaway_frame.get()->data()), 340 reinterpret_cast<unsigned char*>(goaway_frame.get()->data()),
348 goaway_frame.get()->size()); 341 goaway_frame.get()->size());
349 EXPECT_EQ(0, visitor.error_count_); 342 EXPECT_EQ(0, visitor.error_count_);
350 EXPECT_EQ(1, visitor.goaway_count_); 343 EXPECT_EQ(1, visitor.goaway_count_);
351 EXPECT_EQ(2u, visitor.goaway_last_accepted_stream_id_); 344 EXPECT_EQ(2u, visitor.goaway_last_accepted_stream_id_);
352 EXPECT_EQ(GOAWAY_FRAME_SIZE_ERROR, visitor.goaway_status_); 345 EXPECT_EQ(GOAWAY_FRAME_SIZE_ERROR, visitor.goaway_status_);
353 EXPECT_EQ("foo", visitor.goaway_debug_data_); 346 EXPECT_EQ("foo", visitor.goaway_debug_data_);
354 } 347 }
355 348
356 } // namespace net 349 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/buffered_spdy_framer.h ('k') | net/spdy/spdy_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698