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

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

Issue 1905843003: Split out QuicAlarm creation from QuicConnectionHelper to new QuicAlarmFactory. No behavior change,… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@119753783
Patch Set: Rebase Created 4 years, 8 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/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_client.cc » ('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 <stddef.h> 5 #include <stddef.h>
6 #include <sys/epoll.h> 6 #include <sys/epoll.h>
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 // Start the server first, because CreateQuicClient() attempts 355 // Start the server first, because CreateQuicClient() attempts
356 // to connect to the server. 356 // to connect to the server.
357 StartServer(); 357 StartServer();
358 358
359 client_.reset(CreateQuicClient(client_writer_)); 359 client_.reset(CreateQuicClient(client_writer_));
360 static EpollEvent event(EPOLLOUT, false); 360 static EpollEvent event(EPOLLOUT, false);
361 client_writer_->Initialize( 361 client_writer_->Initialize(
362 reinterpret_cast<QuicEpollConnectionHelper*>( 362 reinterpret_cast<QuicEpollConnectionHelper*>(
363 QuicConnectionPeer::GetHelper( 363 QuicConnectionPeer::GetHelper(
364 client_->client()->session()->connection())), 364 client_->client()->session()->connection())),
365 QuicConnectionPeer::GetAlarmFactory(
366 client_->client()->session()->connection()),
365 new ClientDelegate(client_->client())); 367 new ClientDelegate(client_->client()));
368
366 initialized_ = true; 369 initialized_ = true;
367 return client_->client()->connected(); 370 return client_->client()->connected();
368 } 371 }
369 372
370 void SetUp() override { 373 void SetUp() override {
371 // The ownership of these gets transferred to the QuicPacketWriterWrapper 374 // The ownership of these gets transferred to the QuicPacketWriterWrapper
372 // when Initialize() is executed. 375 // when Initialize() is executed.
373 client_writer_ = new PacketDroppingTestWriter(); 376 client_writer_ = new PacketDroppingTestWriter();
374 server_writer_ = new PacketDroppingTestWriter(); 377 server_writer_ = new PacketDroppingTestWriter();
375 } 378 }
(...skipping 16 matching lines...) Expand all
392 server_address_ = 395 server_address_ =
393 IPEndPoint(server_address_.address(), server_thread_->GetPort()); 396 IPEndPoint(server_address_.address(), server_thread_->GetPort());
394 QuicDispatcher* dispatcher = 397 QuicDispatcher* dispatcher =
395 QuicServerPeer::GetDispatcher(server_thread_->server()); 398 QuicServerPeer::GetDispatcher(server_thread_->server());
396 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_); 399 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_);
397 400
398 FLAGS_enable_quic_stateless_reject_support = 401 FLAGS_enable_quic_stateless_reject_support =
399 GetParam().server_uses_stateless_rejects_if_peer_supported; 402 GetParam().server_uses_stateless_rejects_if_peer_supported;
400 403
401 server_writer_->Initialize(QuicDispatcherPeer::GetHelper(dispatcher), 404 server_writer_->Initialize(QuicDispatcherPeer::GetHelper(dispatcher),
405 QuicDispatcherPeer::GetAlarmFactory(dispatcher),
402 new ServerDelegate(dispatcher)); 406 new ServerDelegate(dispatcher));
403 if (stream_factory_ != nullptr) { 407 if (stream_factory_ != nullptr) {
404 static_cast<QuicTestServer*>(server_thread_->server()) 408 static_cast<QuicTestServer*>(server_thread_->server())
405 ->SetSpdyStreamFactory(stream_factory_); 409 ->SetSpdyStreamFactory(stream_factory_);
406 } 410 }
407 411
408 server_thread_->Start(); 412 server_thread_->Start();
409 server_started_ = true; 413 server_started_ = true;
410 } 414 }
411 415
(...skipping 2220 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 // Use a quic client that drops received body. 2636 // Use a quic client that drops received body.
2633 QuicTestClient* client = new QuicTestClientThatDropsBody( 2637 QuicTestClient* client = new QuicTestClientThatDropsBody(
2634 server_address_, server_hostname_, client_config_, 2638 server_address_, server_hostname_, client_config_,
2635 client_supported_versions_); 2639 client_supported_versions_);
2636 client->UseWriter(client_writer_); 2640 client->UseWriter(client_writer_);
2637 client->Connect(); 2641 client->Connect();
2638 client_.reset(client); 2642 client_.reset(client);
2639 static EpollEvent event(EPOLLOUT, false); 2643 static EpollEvent event(EPOLLOUT, false);
2640 client_writer_->Initialize( 2644 client_writer_->Initialize(
2641 QuicConnectionPeer::GetHelper(client_->client()->session()->connection()), 2645 QuicConnectionPeer::GetHelper(client_->client()->session()->connection()),
2646 QuicConnectionPeer::GetAlarmFactory(
2647 client_->client()->session()->connection()),
2642 new ClientDelegate(client_->client())); 2648 new ClientDelegate(client_->client()));
2643 initialized_ = true; 2649 initialized_ = true;
2644 ASSERT_TRUE(client_->client()->connected()); 2650 ASSERT_TRUE(client_->client()->connected());
2645 2651
2646 client_->client()->WaitForCryptoHandshakeConfirmed(); 2652 client_->client()->WaitForCryptoHandshakeConfirmed();
2647 SetPacketLossPercentage(1); 2653 SetPacketLossPercentage(1);
2648 client_->SendRequest("/huge_response"); 2654 client_->SendRequest("/huge_response");
2649 client_->WaitForResponse(); 2655 client_->WaitForResponse();
2650 VerifyCleanConnection(false); 2656 VerifyCleanConnection(false);
2651 } 2657 }
2652 2658
2653 } // namespace 2659 } // namespace
2654 } // namespace test 2660 } // namespace test
2655 } // namespace net 2661 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698