| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/test_tools/server_thread.h" | 5 #include "net/tools/quic/test_tools/server_thread.h" |
| 6 | 6 |
| 7 #include "net/quic/test_tools/crypto_test_utils.h" | 7 #include "net/quic/test_tools/crypto_test_utils.h" |
| 8 #include "net/tools/quic/quic_dispatcher.h" | 8 #include "net/tools/quic/quic_dispatcher.h" |
| 9 #include "net/tools/quic/test_tools/quic_server_peer.h" | 9 #include "net/tools/quic/test_tools/quic_server_peer.h" |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 namespace tools { | 12 namespace tools { |
| 13 namespace test { | 13 namespace test { |
| 14 | 14 |
| 15 ServerThread::ServerThread(QuicServer* server, | 15 ServerThread::ServerThread(QuicServer* server, |
| 16 bool is_secure, | |
| 17 const IPEndPoint& address, | 16 const IPEndPoint& address, |
| 18 bool strike_register_no_startup_period) | 17 bool strike_register_no_startup_period) |
| 19 : SimpleThread("server_thread"), | 18 : SimpleThread("server_thread"), |
| 20 confirmed_(true, false), | 19 confirmed_(true, false), |
| 21 pause_(true, false), | 20 pause_(true, false), |
| 22 paused_(true, false), | 21 paused_(true, false), |
| 23 resume_(true, false), | 22 resume_(true, false), |
| 24 quit_(true, false), | 23 quit_(true, false), |
| 25 server_(server), | 24 server_(server), |
| 26 address_(address), | 25 address_(address), |
| 27 port_(0), | 26 port_(0), |
| 28 initialized_(false) { | 27 initialized_(false) { |
| 29 if (strike_register_no_startup_period) { | 28 if (strike_register_no_startup_period) { |
| 30 server_->SetStrikeRegisterNoStartupPeriod(); | 29 server_->SetStrikeRegisterNoStartupPeriod(); |
| 31 } | 30 } |
| 32 if (is_secure) { | |
| 33 // TODO(rtenneti): replace this with ProofSourceForTesting() when Chromium | |
| 34 // has a working ProofSourceForTesting(). | |
| 35 server_->SetProofSource( | |
| 36 net::test::CryptoTestUtils::FakeProofSourceForTesting()); | |
| 37 } | |
| 38 } | 31 } |
| 39 | 32 |
| 40 ServerThread::~ServerThread() {} | 33 ServerThread::~ServerThread() {} |
| 41 | 34 |
| 42 void ServerThread::Initialize() { | 35 void ServerThread::Initialize() { |
| 43 if (initialized_) { | 36 if (initialized_) { |
| 44 return; | 37 return; |
| 45 } | 38 } |
| 46 | 39 |
| 47 server_->Listen(address_); | 40 server_->Listen(address_); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 105 } |
| 113 QuicSession* session = dispatcher->session_map().begin()->second; | 106 QuicSession* session = dispatcher->session_map().begin()->second; |
| 114 if (session->IsCryptoHandshakeConfirmed()) { | 107 if (session->IsCryptoHandshakeConfirmed()) { |
| 115 confirmed_.Signal(); | 108 confirmed_.Signal(); |
| 116 } | 109 } |
| 117 } | 110 } |
| 118 | 111 |
| 119 } // namespace test | 112 } // namespace test |
| 120 } // namespace tools | 113 } // namespace tools |
| 121 } // namespace net | 114 } // namespace net |
| OLD | NEW |