OLD | NEW |
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 "net/quic/test_tools/simulator/quic_endpoint.h" | 5 #include "net/quic/test_tools/simulator/quic_endpoint.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "net/quic/core/crypto/crypto_handshake_message.h" | 10 #include "net/quic/core/crypto/crypto_handshake_message.h" |
11 #include "net/quic/core/crypto/crypto_protocol.h" | 11 #include "net/quic/core/crypto/crypto_protocol.h" |
| 12 #include "net/quic/test_tools/quic_test_utils.h" |
12 #include "net/quic/test_tools/simulator/simulator.h" | 13 #include "net/quic/test_tools/simulator/simulator.h" |
13 | 14 |
14 using base::StringPrintf; | 15 using base::StringPrintf; |
15 using std::string; | 16 using std::string; |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 namespace simulator { | 19 namespace simulator { |
19 | 20 |
20 const QuicStreamId kDataStream = 3; | 21 const QuicStreamId kDataStream = 3; |
21 const QuicByteCount kWriteChunkSize = 128 * 1024; | 22 const QuicByteCount kWriteChunkSize = 128 * 1024; |
22 const char kStreamDataContents = 'Q'; | 23 const char kStreamDataContents = 'Q'; |
23 | 24 |
24 // Takes a SHA-1 hash of the name and converts it into five 32-bit integers. | 25 // Takes a SHA-1 hash of the name and converts it into five 32-bit integers. |
25 static std::vector<uint32_t> HashNameIntoFive32BitIntegers(string name) { | 26 static std::vector<uint32_t> HashNameIntoFive32BitIntegers(string name) { |
26 const std::string hash = base::SHA1HashString(name); | 27 const string hash = test::Sha1Hash(name); |
27 | 28 |
28 std::vector<uint32_t> output; | 29 std::vector<uint32_t> output; |
29 uint32_t current_number = 0; | 30 uint32_t current_number = 0; |
30 for (size_t i = 0; i < hash.size(); i++) { | 31 for (size_t i = 0; i < hash.size(); i++) { |
31 current_number = (current_number << 8) + hash[i]; | 32 current_number = (current_number << 8) + hash[i]; |
32 if (i % 4 == 3) { | 33 if (i % 4 == 3) { |
33 output.push_back(i); | 34 output.push_back(i); |
34 current_number = 0; | 35 current_number = 0; |
35 } | 36 } |
36 } | 37 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 return this; | 268 return this; |
268 } | 269 } |
269 void QuicEndpointMultiplexer::SetTxPort(ConstrainedPortInterface* port) { | 270 void QuicEndpointMultiplexer::SetTxPort(ConstrainedPortInterface* port) { |
270 for (auto& key_value_pair : mapping_) { | 271 for (auto& key_value_pair : mapping_) { |
271 key_value_pair.second->SetTxPort(port); | 272 key_value_pair.second->SetTxPort(port); |
272 } | 273 } |
273 } | 274 } |
274 | 275 |
275 } // namespace simulator | 276 } // namespace simulator |
276 } // namespace net | 277 } // namespace net |
OLD | NEW |