Chromium Code Reviews| Index: net/quic/test_tools/simulator/simulator_test.cc |
| diff --git a/net/quic/test_tools/simulator/simulator_test.cc b/net/quic/test_tools/simulator/simulator_test.cc |
| index 235d64c5f55425de99a3c73cf3b8812650a78bc4..577491e41983ce4a80062226337c28b67ce9335a 100644 |
| --- a/net/quic/test_tools/simulator/simulator_test.cc |
| +++ b/net/quic/test_tools/simulator/simulator_test.cc |
| @@ -309,10 +309,9 @@ TEST(SimulatorTest, QueueBottleneck) { |
| saturator.SetTxPort(&local_link); |
| queue.set_tx_port(&bottleneck_link); |
| - const QuicPacketCount packets_received = 1000; |
| - simulator.RunUntil([&counter, packets_received]() { |
| - return counter.packets() == packets_received; |
| - }); |
| + static const QuicPacketCount packets_received = 1000; |
|
eroman
2017/01/20 17:49:25
[optional] These should probably be renamed to kPa
krasin1
2017/01/20 18:02:20
Let's leave it as is. Yesterday, in a similar case
|
| + simulator.RunUntil( |
| + [&counter]() { return counter.packets() == packets_received; }); |
| const double loss_ratio = |
| 1 - |
| static_cast<double>(packets_received) / saturator.packets_transmitted(); |
| @@ -343,12 +342,12 @@ TEST(SimulatorTest, OnePacketQueue) { |
| saturator.SetTxPort(&local_link); |
| queue.set_tx_port(&bottleneck_link); |
| - const QuicPacketCount packets_received = 10; |
| + static const QuicPacketCount packets_received = 10; |
| // The deadline here is to prevent this tests from looping infinitely in case |
| // the packets never reach the receiver. |
| const QuicTime deadline = |
| simulator.GetClock()->Now() + QuicTime::Delta::FromSeconds(10); |
| - simulator.RunUntil([&simulator, &counter, packets_received, deadline]() { |
| + simulator.RunUntil([&simulator, &counter, deadline]() { |
| return counter.packets() == packets_received || |
| simulator.GetClock()->Now() > deadline; |
| }); |
| @@ -379,8 +378,8 @@ TEST(SimulatorTest, SwitchedNetwork) { |
| base_propagation_delay * 3); |
| const QuicTime start_time = simulator.GetClock()->Now(); |
| - const QuicPacketCount bytes_received = 64 * 1000; |
| - simulator.RunUntil([&saturator1, bytes_received]() { |
| + static const QuicPacketCount bytes_received = 64 * 1000; |
| + simulator.RunUntil([&saturator1]() { |
| return saturator1.counter()->bytes() >= bytes_received; |
| }); |
| const QuicTime end_time = simulator.GetClock()->Now(); |
| @@ -630,9 +629,9 @@ TEST(SimulatorTest, TrafficPolicer) { |
| Switch network_switch(&simulator, "Switch", 8, |
| bandwidth * base_propagation_delay * 10); |
| - const QuicByteCount initial_burst = 1000 * 10; |
| - const QuicByteCount max_bucket_size = 1000 * 100; |
| - const QuicBandwidth target_bandwidth = bandwidth * 0.25; |
| + static const QuicByteCount initial_burst = 1000 * 10; |
| + static const QuicByteCount max_bucket_size = 1000 * 100; |
| + static const QuicBandwidth target_bandwidth = bandwidth * 0.25; |
| TrafficPolicer policer(&simulator, "Policer", initial_burst, max_bucket_size, |
| target_bandwidth, network_switch.port(2)); |
| @@ -642,14 +641,14 @@ TEST(SimulatorTest, TrafficPolicer) { |
| // Ensure the initial burst passes without being dropped at all. |
| bool simulator_result = simulator.RunUntilOrTimeout( |
| - [&saturator1, initial_burst]() { |
| + [&saturator1]() { |
| return saturator1.bytes_transmitted() == initial_burst; |
| }, |
| timeout); |
| ASSERT_TRUE(simulator_result); |
| saturator1.Pause(); |
| simulator_result = simulator.RunUntilOrTimeout( |
| - [&saturator2, initial_burst]() { |
| + [&saturator2]() { |
| return saturator2.counter()->bytes() == initial_burst; |
| }, |
| timeout); |