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

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

Issue 1898793003: Make QuicDispatcher's helper and alarm factory arguments unique_ptrs to make ownership clear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@119871679
Patch Set: fixing 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.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 <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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 if (GetParam().client_supports_stateless_rejects) { 347 if (GetParam().client_supports_stateless_rejects) {
348 copt.push_back(kSREJ); 348 copt.push_back(kSREJ);
349 } 349 }
350 client_config_.SetConnectionOptionsToSend(copt); 350 client_config_.SetConnectionOptionsToSend(copt);
351 351
352 // Start the server first, because CreateQuicClient() attempts 352 // Start the server first, because CreateQuicClient() attempts
353 // to connect to the server. 353 // to connect to the server.
354 StartServer(); 354 StartServer();
355 355
356 client_.reset(CreateQuicClient(client_writer_)); 356 client_.reset(CreateQuicClient(client_writer_));
357 static EpollEvent event(EPOLLOUT, false);
358 client_writer_->Initialize( 357 client_writer_->Initialize(
359 reinterpret_cast<QuicEpollConnectionHelper*>( 358 reinterpret_cast<QuicEpollConnectionHelper*>(
360 QuicConnectionPeer::GetHelper( 359 QuicConnectionPeer::GetHelper(
361 client_->client()->session()->connection())), 360 client_->client()->session()->connection())),
361 reinterpret_cast<QuicEpollAlarmFactory*>(
362 QuicConnectionPeer::GetAlarmFactory(
363 client_->client()->session()->connection())),
362 new ClientDelegate(client_->client())); 364 new ClientDelegate(client_->client()));
363 initialized_ = true; 365 initialized_ = true;
364 return client_->client()->connected(); 366 return client_->client()->connected();
365 } 367 }
366 368
367 void SetUp() override { 369 void SetUp() override {
368 // The ownership of these gets transferred to the QuicPacketWriterWrapper 370 // The ownership of these gets transferred to the QuicPacketWriterWrapper
369 // when Initialize() is executed. 371 // when Initialize() is executed.
370 client_writer_ = new PacketDroppingTestWriter(); 372 client_writer_ = new PacketDroppingTestWriter();
371 server_writer_ = new PacketDroppingTestWriter(); 373 server_writer_ = new PacketDroppingTestWriter();
(...skipping 17 matching lines...) Expand all
389 server_address_ = 391 server_address_ =
390 IPEndPoint(server_address_.address(), server_thread_->GetPort()); 392 IPEndPoint(server_address_.address(), server_thread_->GetPort());
391 QuicDispatcher* dispatcher = 393 QuicDispatcher* dispatcher =
392 QuicServerPeer::GetDispatcher(server_thread_->server()); 394 QuicServerPeer::GetDispatcher(server_thread_->server());
393 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_); 395 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_);
394 396
395 FLAGS_enable_quic_stateless_reject_support = 397 FLAGS_enable_quic_stateless_reject_support =
396 GetParam().server_uses_stateless_rejects_if_peer_supported; 398 GetParam().server_uses_stateless_rejects_if_peer_supported;
397 399
398 server_writer_->Initialize(QuicDispatcherPeer::GetHelper(dispatcher), 400 server_writer_->Initialize(QuicDispatcherPeer::GetHelper(dispatcher),
401 QuicDispatcherPeer::GetAlarmFactory(dispatcher),
399 new ServerDelegate(dispatcher)); 402 new ServerDelegate(dispatcher));
400 if (stream_factory_ != nullptr) { 403 if (stream_factory_ != nullptr) {
401 static_cast<QuicTestServer*>(server_thread_->server()) 404 static_cast<QuicTestServer*>(server_thread_->server())
402 ->SetSpdyStreamFactory(stream_factory_); 405 ->SetSpdyStreamFactory(stream_factory_);
403 } 406 }
404 407
405 server_thread_->Start(); 408 server_thread_->Start();
406 server_started_ = true; 409 server_started_ = true;
407 } 410 }
408 411
(...skipping 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2595 // Use a quic client that drops received body. 2598 // Use a quic client that drops received body.
2596 QuicTestClient* client = new QuicTestClientThatDropsBody( 2599 QuicTestClient* client = new QuicTestClientThatDropsBody(
2597 server_address_, server_hostname_, client_config_, 2600 server_address_, server_hostname_, client_config_,
2598 client_supported_versions_); 2601 client_supported_versions_);
2599 client->UseWriter(client_writer_); 2602 client->UseWriter(client_writer_);
2600 client->Connect(); 2603 client->Connect();
2601 client_.reset(client); 2604 client_.reset(client);
2602 static EpollEvent event(EPOLLOUT, false); 2605 static EpollEvent event(EPOLLOUT, false);
2603 client_writer_->Initialize( 2606 client_writer_->Initialize(
2604 QuicConnectionPeer::GetHelper(client_->client()->session()->connection()), 2607 QuicConnectionPeer::GetHelper(client_->client()->session()->connection()),
2608 QuicConnectionPeer::GetAlarmFactory(
2609 client_->client()->session()->connection()),
2605 new ClientDelegate(client_->client())); 2610 new ClientDelegate(client_->client()));
2606 initialized_ = true; 2611 initialized_ = true;
2607 ASSERT_TRUE(client_->client()->connected()); 2612 ASSERT_TRUE(client_->client()->connected());
2608 2613
2609 client_->client()->WaitForCryptoHandshakeConfirmed(); 2614 client_->client()->WaitForCryptoHandshakeConfirmed();
2610 SetPacketLossPercentage(1); 2615 SetPacketLossPercentage(1);
2611 client_->SendRequest("/huge_response"); 2616 client_->SendRequest("/huge_response");
2612 client_->WaitForResponse(); 2617 client_->WaitForResponse();
2613 VerifyCleanConnection(false); 2618 VerifyCleanConnection(false);
2614 } 2619 }
2615 2620
2616 } // namespace 2621 } // namespace
2617 } // namespace test 2622 } // namespace test
2618 } // namespace net 2623 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698