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

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

Issue 23691073: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compiler/unittests fix Created 7 years, 3 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 | Annotate | Revision Log
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 <stddef.h> 5 #include <stddef.h>
6 #include <string> 6 #include <string>
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 request.AddHeader("content-length", "3"); 416 request.AddHeader("content-length", "3");
417 request.set_skip_message_validation(true); 417 request.set_skip_message_validation(true);
418 418
419 // This should be detected as stream fin without complete request, 419 // This should be detected as stream fin without complete request,
420 // triggering an error response. 420 // triggering an error response.
421 client_->SendCustomSynchronousRequest(request); 421 client_->SendCustomSynchronousRequest(request);
422 EXPECT_EQ("bad", client_->response_body()); 422 EXPECT_EQ("bad", client_->response_body());
423 EXPECT_EQ(500u, client_->response_headers()->parsed_response_code()); 423 EXPECT_EQ(500u, client_->response_headers()->parsed_response_code());
424 } 424 }
425 425
426 TEST_P(EndToEndTest, LargePost) { 426 TEST_P(EndToEndTest, LargePostNoPacketLoss) {
427 // TODO(rtenneti): Delete this when NSS is supported. 427 // TODO(rtenneti): Delete this when NSS is supported.
428 if (!Aes128Gcm12Encrypter::IsSupported()) { 428 if (!Aes128Gcm12Encrypter::IsSupported()) {
429 LOG(INFO) << "AES GCM not supported. Test skipped."; 429 LOG(INFO) << "AES GCM not supported. Test skipped.";
430 return;
431 }
432
433 ASSERT_TRUE(Initialize());
434
435 client_->client()->WaitForCryptoHandshakeConfirmed();
436
437 // 1 Mb body.
438 string body;
439 GenerateBody(&body, 1024 * 1024);
440
441 HTTPMessage request(HttpConstants::HTTP_1_1,
442 HttpConstants::POST, "/foo");
443 request.AddBody(body, true);
444
445 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
446 }
447
448 TEST_P(EndToEndTest, LargePostWithPacketLoss) {
449 // TODO(rtenneti): Delete this when NSS is supported.
450 if (!Aes128Gcm12Encrypter::IsSupported()) {
451 LOG(INFO) << "AES GCM not supported. Test skipped.";
430 return; 452 return;
431 } 453 }
432 454
433 // Connect with lower fake packet loss than we'd like to test. Until 455 // Connect with lower fake packet loss than we'd like to test. Until
434 // b/10126687 is fixed, losing handshake packets is pretty brutal. 456 // b/10126687 is fixed, losing handshake packets is pretty brutal.
435 // FLAGS_fake_packet_loss_percentage = 5; 457 // FLAGS_fake_packet_loss_percentage = 5;
436 ASSERT_TRUE(Initialize()); 458 ASSERT_TRUE(Initialize());
437 459
438 // Wait for the server SHLO before upping the packet loss. 460 // Wait for the server SHLO before upping the packet loss.
439 client_->client()->WaitForCryptoHandshakeConfirmed(); 461 client_->client()->WaitForCryptoHandshakeConfirmed();
440 // FLAGS_fake_packet_loss_percentage = 30; 462 // FLAGS_fake_packet_loss_percentage = 30;
441 463
464 // 10 Kb body.
442 string body; 465 string body;
443 GenerateBody(&body, 10240); 466 GenerateBody(&body, 1024 * 10);
444 467
445 HTTPMessage request(HttpConstants::HTTP_1_1, 468 HTTPMessage request(HttpConstants::HTTP_1_1,
446 HttpConstants::POST, "/foo"); 469 HttpConstants::POST, "/foo");
447 request.AddBody(body, true); 470 request.AddBody(body, true);
448 471
449 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); 472 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
450 } 473 }
451 474
452 TEST_P(EndToEndTest, LargePostZeroRTTFailure) { 475 TEST_P(EndToEndTest, LargePostZeroRTTFailure) {
453 // Have the server accept 0-RTT without waiting a startup period. 476 // Have the server accept 0-RTT without waiting a startup period.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 579
557 // TODO(rch): this test seems to cause net_unittests timeouts :| 580 // TODO(rch): this test seems to cause net_unittests timeouts :|
558 TEST_P(EndToEndTest, DISABLED_MultipleTermination) { 581 TEST_P(EndToEndTest, DISABLED_MultipleTermination) {
559 // TODO(rtenneti): Delete this when NSS is supported. 582 // TODO(rtenneti): Delete this when NSS is supported.
560 if (!Aes128Gcm12Encrypter::IsSupported()) { 583 if (!Aes128Gcm12Encrypter::IsSupported()) {
561 LOG(INFO) << "AES GCM not supported. Test skipped."; 584 LOG(INFO) << "AES GCM not supported. Test skipped.";
562 return; 585 return;
563 } 586 }
564 587
565 ASSERT_TRUE(Initialize()); 588 ASSERT_TRUE(Initialize());
566 scoped_ptr<QuicTestClient> client2(CreateQuicClient());
567 589
568 HTTPMessage request(HttpConstants::HTTP_1_1, 590 HTTPMessage request(HttpConstants::HTTP_1_1,
569 HttpConstants::POST, "/foo"); 591 HttpConstants::POST, "/foo");
570 request.AddHeader("content-length", "3"); 592 request.AddHeader("content-length", "3");
571 request.set_has_complete_message(false); 593 request.set_has_complete_message(false);
572 594
573 // Set the offset so we won't frame. Otherwise when we pick up termination 595 // Set the offset so we won't frame. Otherwise when we pick up termination
574 // before HTTP framing is complete, we send an error and close the stream, 596 // before HTTP framing is complete, we send an error and close the stream,
575 // and the second write is picked up as writing on a closed stream. 597 // and the second write is picked up as writing on a closed stream.
576 QuicReliableClientStream* stream = client_->GetOrCreateStream(); 598 QuicReliableClientStream* stream = client_->GetOrCreateStream();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 QuicEpollConnectionHelperPeer::SetWriter(helper, NULL); 732 QuicEpollConnectionHelperPeer::SetWriter(helper, NULL);
711 733
712 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); 734 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error());
713 EXPECT_EQ(QUIC_ERROR_MIGRATING_ADDRESS, client_->connection_error()); 735 EXPECT_EQ(QUIC_ERROR_MIGRATING_ADDRESS, client_->connection_error());
714 } 736 }
715 737
716 } // namespace 738 } // namespace
717 } // namespace test 739 } // namespace test
718 } // namespace tools 740 } // namespace tools
719 } // namespace net 741 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_epoll_connection_helper_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698