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

Side by Side Diff: net/tools/quic/quic_simple_server_stream_test.cc

Issue 2249813002: Create EXPECT_QUIC_BUG macro, and modify QUIC tests to use it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/tools/quic/quic_simple_server_session_test.cc ('k') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/tools/quic/quic_simple_server_stream.h" 5 #include "net/tools/quic/quic_simple_server_stream.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 QuicRandom::GetInstance(), 183 QuicRandom::GetInstance(),
184 ::net::test::CryptoTestUtils::ProofSourceForTesting())), 184 ::net::test::CryptoTestUtils::ProofSourceForTesting())),
185 compressed_certs_cache_( 185 compressed_certs_cache_(
186 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize), 186 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize),
187 session_(connection_, 187 session_(connection_,
188 &session_owner_, 188 &session_owner_,
189 &session_helper_, 189 &session_helper_,
190 crypto_config_.get(), 190 crypto_config_.get(),
191 &compressed_certs_cache_), 191 &compressed_certs_cache_),
192 body_("hello world") { 192 body_("hello world") {
193 FLAGS_quic_always_log_bugs_for_tests = true;
194 SpdyHeaderBlock request_headers; 193 SpdyHeaderBlock request_headers;
195 request_headers[":host"] = ""; 194 request_headers[":host"] = "";
196 request_headers[":authority"] = "www.google.com"; 195 request_headers[":authority"] = "www.google.com";
197 request_headers[":path"] = "/"; 196 request_headers[":path"] = "/";
198 request_headers[":method"] = "POST"; 197 request_headers[":method"] = "POST";
199 request_headers[":version"] = "HTTP/1.1"; 198 request_headers[":version"] = "HTTP/1.1";
200 request_headers["content-length"] = "11"; 199 request_headers["content-length"] = "11";
201 200
202 headers_string_ = 201 headers_string_ =
203 net::SpdyUtils::SerializeUncompressedHeaders(request_headers); 202 net::SpdyUtils::SerializeUncompressedHeaders(request_headers);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 EXPECT_CALL(session_, WritevData(_, _, _, _, _, _)) 460 EXPECT_CALL(session_, WritevData(_, _, _, _, _, _))
462 .Times(1) 461 .Times(1)
463 .WillOnce(Return(QuicConsumedData(body.length(), true))); 462 .WillOnce(Return(QuicConsumedData(body.length(), true)));
464 QuicSimpleServerStreamPeer::SendResponse(stream_); 463 QuicSimpleServerStreamPeer::SendResponse(stream_);
465 EXPECT_EQ(*request_headers, session_.original_request_headers_); 464 EXPECT_EQ(*request_headers, session_.original_request_headers_);
466 } 465 }
467 466
468 TEST_P(QuicSimpleServerStreamTest, PushResponseOnClientInitiatedStream) { 467 TEST_P(QuicSimpleServerStreamTest, PushResponseOnClientInitiatedStream) {
469 // Calling PushResponse() on a client initialted stream is never supposed to 468 // Calling PushResponse() on a client initialted stream is never supposed to
470 // happen. 469 // happen.
471 EXPECT_DFATAL(stream_->PushResponse(SpdyHeaderBlock()), 470 EXPECT_QUIC_BUG(stream_->PushResponse(SpdyHeaderBlock()),
472 "Client initiated stream" 471 "Client initiated stream"
473 " shouldn't be used as promised stream."); 472 " shouldn't be used as promised stream.");
474 } 473 }
475 474
476 TEST_P(QuicSimpleServerStreamTest, PushResponseOnServerInitiatedStream) { 475 TEST_P(QuicSimpleServerStreamTest, PushResponseOnServerInitiatedStream) {
477 // Tests that PushResponse() should take the given headers as request headers 476 // Tests that PushResponse() should take the given headers as request headers
478 // and fetch response from cache, and send it out. 477 // and fetch response from cache, and send it out.
479 478
480 // Create a stream with even stream id and test against this stream. 479 // Create a stream with even stream id and test against this stream.
481 const QuicStreamId kServerInitiatedStreamId = 2; 480 const QuicStreamId kServerInitiatedStreamId = 2;
482 // Create a server initiated stream and pass it to session_. 481 // Create a server initiated stream and pass it to session_.
483 QuicSimpleServerStreamPeer* server_initiated_stream = 482 QuicSimpleServerStreamPeer* server_initiated_stream =
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 }; 643 };
645 StringPiece data(arr, arraysize(arr)); 644 StringPiece data(arr, arraysize(arr));
646 QuicStreamFrame frame(stream_->id(), true, 0, data); 645 QuicStreamFrame frame(stream_->id(), true, 0, data);
647 // Verify that we don't crash when we get a invalid headers in stream frame. 646 // Verify that we don't crash when we get a invalid headers in stream frame.
648 stream_->OnStreamFrame(frame); 647 stream_->OnStreamFrame(frame);
649 } 648 }
650 649
651 } // namespace 650 } // namespace
652 } // namespace test 651 } // namespace test
653 } // namespace net 652 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_server_session_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698