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 "net/quic/platform/api/quic_ptr_util.h" | 7 #include "net/quic/platform/api/quic_ptr_util.h" |
| 8 #include "net/quic/platform/api/quic_test.h" |
8 #include "net/quic/test_tools/quic_connection_peer.h" | 9 #include "net/quic/test_tools/quic_connection_peer.h" |
9 #include "net/quic/test_tools/quic_test_utils.h" | 10 #include "net/quic/test_tools/quic_test_utils.h" |
10 #include "net/quic/test_tools/simulator/simulator.h" | 11 #include "net/quic/test_tools/simulator/simulator.h" |
11 #include "net/quic/test_tools/simulator/switch.h" | 12 #include "net/quic/test_tools/simulator/switch.h" |
12 | 13 |
13 #include "testing/gmock/include/gmock/gmock.h" | |
14 #include "testing/gtest/include/gtest/gtest.h" | |
15 | 14 |
16 using ::testing::_; | 15 using ::testing::_; |
17 using ::testing::NiceMock; | 16 using ::testing::NiceMock; |
18 using ::testing::Return; | 17 using ::testing::Return; |
19 using net::test::GetPeerInMemoryConnectionId; | 18 using net::test::GetPeerInMemoryConnectionId; |
20 | 19 |
21 namespace net { | 20 namespace net { |
22 namespace simulator { | 21 namespace simulator { |
23 | 22 |
24 const QuicBandwidth kDefaultBandwidth = | 23 const QuicBandwidth kDefaultBandwidth = |
25 QuicBandwidth::FromKBitsPerSecond(10 * 1000); | 24 QuicBandwidth::FromKBitsPerSecond(10 * 1000); |
26 const QuicTime::Delta kDefaultPropagationDelay = | 25 const QuicTime::Delta kDefaultPropagationDelay = |
27 QuicTime::Delta::FromMilliseconds(20); | 26 QuicTime::Delta::FromMilliseconds(20); |
28 const QuicByteCount kDefaultBdp = kDefaultBandwidth * kDefaultPropagationDelay; | 27 const QuicByteCount kDefaultBdp = kDefaultBandwidth * kDefaultPropagationDelay; |
29 | 28 |
30 // A simple test harness where all hosts are connected to a switch with | 29 // A simple test harness where all hosts are connected to a switch with |
31 // identical links. | 30 // identical links. |
32 class QuicEndpointTest : public ::testing::Test { | 31 class QuicEndpointTest : public QuicTest { |
33 public: | 32 public: |
34 QuicEndpointTest() | 33 QuicEndpointTest() |
35 : simulator_(), switch_(&simulator_, "Switch", 8, kDefaultBdp * 2) {} | 34 : simulator_(), switch_(&simulator_, "Switch", 8, kDefaultBdp * 2) {} |
36 | 35 |
37 protected: | 36 protected: |
38 Simulator simulator_; | 37 Simulator simulator_; |
39 Switch switch_; | 38 Switch switch_; |
40 | 39 |
41 std::unique_ptr<SymmetricLink> Link(Endpoint* a, Endpoint* b) { | 40 std::unique_ptr<SymmetricLink> Link(Endpoint* a, Endpoint* b) { |
42 return QuicMakeUnique<SymmetricLink>(a, b, kDefaultBandwidth, | 41 return QuicMakeUnique<SymmetricLink>(a, b, kDefaultBandwidth, |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 188 } |
190 for (QuicEndpoint* endpoint : | 189 for (QuicEndpoint* endpoint : |
191 {endpoint_d_a.get(), endpoint_d_b.get(), endpoint_d_c.get()}) { | 190 {endpoint_d_a.get(), endpoint_d_b.get(), endpoint_d_c.get()}) { |
192 EXPECT_EQ(2u * 1024u * 1024u, endpoint->bytes_received()); | 191 EXPECT_EQ(2u * 1024u * 1024u, endpoint->bytes_received()); |
193 EXPECT_FALSE(endpoint->wrong_data_received()); | 192 EXPECT_FALSE(endpoint->wrong_data_received()); |
194 } | 193 } |
195 } | 194 } |
196 | 195 |
197 } // namespace simulator | 196 } // namespace simulator |
198 } // namespace net | 197 } // namespace net |
OLD | NEW |