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

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

Issue 2718053003: Fix BufferedSpdyFrameTest.OnAltSvc. (Closed)
Patch Set: Remove; remove tests for functionality that has been removed in https://crrev.com/2723203002. Created 3 years, 9 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 | « no previous file | no next file » | 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 <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 TestBufferedSpdyVisitor visitor; 278 TestBufferedSpdyVisitor visitor;
279 visitor.SimulateInFramer(goaway_frame); 279 visitor.SimulateInFramer(goaway_frame);
280 EXPECT_EQ(0, visitor.error_count_); 280 EXPECT_EQ(0, visitor.error_count_);
281 EXPECT_EQ(1, visitor.goaway_count_); 281 EXPECT_EQ(1, visitor.goaway_count_);
282 EXPECT_EQ(2u, visitor.goaway_last_accepted_stream_id_); 282 EXPECT_EQ(2u, visitor.goaway_last_accepted_stream_id_);
283 EXPECT_EQ(ERROR_CODE_FRAME_SIZE_ERROR, visitor.goaway_error_code_); 283 EXPECT_EQ(ERROR_CODE_FRAME_SIZE_ERROR, visitor.goaway_error_code_);
284 EXPECT_EQ("foo", visitor.goaway_debug_data_); 284 EXPECT_EQ("foo", visitor.goaway_debug_data_);
285 } 285 }
286 286
287 TEST_F(BufferedSpdyFramerTest, OnAltSvc) { 287 // ALTSVC frame on stream 0 must have an origin.
288 const SpdyStreamId altsvc_stream_id(1); 288 TEST_F(BufferedSpdyFramerTest, OnAltSvcOnStreamZero) {
289 const char altsvc_origin[] = "https://www.example.org"; 289 const SpdyStreamId altsvc_stream_id(0);
290 SpdyAltSvcIR altsvc_ir(altsvc_stream_id); 290 SpdyAltSvcIR altsvc_ir(altsvc_stream_id);
291 SpdyAltSvcWireFormat::AlternativeService alternative_service( 291 SpdyAltSvcWireFormat::AlternativeService alternative_service(
292 "quic", "alternative.example.org", 443, 86400, 292 "quic", "alternative.example.org", 443, 86400,
293 SpdyAltSvcWireFormat::VersionVector()); 293 SpdyAltSvcWireFormat::VersionVector());
294 altsvc_ir.add_altsvc(alternative_service); 294 altsvc_ir.add_altsvc(alternative_service);
295 const char altsvc_origin[] = "https://www.example.org";
295 altsvc_ir.set_origin(altsvc_origin); 296 altsvc_ir.set_origin(altsvc_origin);
296 BufferedSpdyFramer framer; 297 BufferedSpdyFramer framer;
297 SpdySerializedFrame altsvc_frame(framer.SerializeFrame(altsvc_ir)); 298 SpdySerializedFrame altsvc_frame(framer.SerializeFrame(altsvc_ir));
298 299
299 TestBufferedSpdyVisitor visitor; 300 TestBufferedSpdyVisitor visitor;
300 visitor.SimulateInFramer(altsvc_frame); 301 visitor.SimulateInFramer(altsvc_frame);
301 EXPECT_EQ(0, visitor.error_count_); 302 EXPECT_EQ(0, visitor.error_count_);
302 EXPECT_EQ(1, visitor.altsvc_count_); 303 EXPECT_EQ(1, visitor.altsvc_count_);
303 EXPECT_EQ(altsvc_stream_id, visitor.altsvc_stream_id_); 304 EXPECT_EQ(altsvc_stream_id, visitor.altsvc_stream_id_);
304 EXPECT_EQ(altsvc_origin, visitor.altsvc_origin_); 305 EXPECT_EQ(altsvc_origin, visitor.altsvc_origin_);
305 ASSERT_EQ(1u, visitor.altsvc_vector_.size()); 306 ASSERT_EQ(1u, visitor.altsvc_vector_.size());
306 EXPECT_EQ(alternative_service, visitor.altsvc_vector_[0]); 307 EXPECT_EQ(alternative_service, visitor.altsvc_vector_[0]);
307 } 308 }
308 309
310 // ALTSVC frame on a non-zero stream must not have an origin.
311 TEST_F(BufferedSpdyFramerTest, OnAltSvcOnNonzeroStream) {
312 const SpdyStreamId altsvc_stream_id(1);
313 SpdyAltSvcIR altsvc_ir(altsvc_stream_id);
314 SpdyAltSvcWireFormat::AlternativeService alternative_service(
315 "quic", "alternative.example.org", 443, 86400,
316 SpdyAltSvcWireFormat::VersionVector());
317 altsvc_ir.add_altsvc(alternative_service);
318 BufferedSpdyFramer framer;
319 SpdySerializedFrame altsvc_frame(framer.SerializeFrame(altsvc_ir));
320
321 TestBufferedSpdyVisitor visitor;
322 visitor.SimulateInFramer(altsvc_frame);
323 EXPECT_EQ(0, visitor.error_count_);
324 EXPECT_EQ(1, visitor.altsvc_count_);
325 EXPECT_EQ(altsvc_stream_id, visitor.altsvc_stream_id_);
326 EXPECT_TRUE(visitor.altsvc_origin_.empty());
327 ASSERT_EQ(1u, visitor.altsvc_vector_.size());
328 EXPECT_EQ(alternative_service, visitor.altsvc_vector_[0]);
329 }
330
309 } // namespace net 331 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698