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 <string> |
| 6 |
5 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
6 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
7 #include "chrome/browser/net/network_stats.h" | 9 #include "chrome/browser/net/network_stats.h" |
8 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
9 #include "net/base/network_change_notifier.h" | 11 #include "net/base/network_change_notifier.h" |
10 #include "net/base/test_completion_callback.h" | 12 #include "net/base/test_completion_callback.h" |
11 #include "net/dns/host_resolver.h" | 13 #include "net/dns/host_resolver.h" |
12 #include "net/dns/mock_host_resolver.h" | 14 #include "net/dns/mock_host_resolver.h" |
13 #include "net/socket/socket_test_util.h" | 15 #include "net/socket/socket_test_util.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 14 matching lines...) Expand all Loading... |
29 } | 31 } |
30 | 32 |
31 void TearDown() override { | 33 void TearDown() override { |
32 net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); | 34 net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); |
33 // Empty the current queue. | 35 // Empty the current queue. |
34 base::MessageLoop::current()->RunUntilIdle(); | 36 base::MessageLoop::current()->RunUntilIdle(); |
35 PlatformTest::TearDown(); | 37 PlatformTest::TearDown(); |
36 } | 38 } |
37 | 39 |
38 void CreateToken(uint64 timestamp_micros, | 40 void CreateToken(uint64 timestamp_micros, |
39 const string& hash, | 41 const std::string& hash, |
40 ProbePacket_Token* token) { | 42 ProbePacket_Token* token) { |
41 token->set_timestamp_micros(timestamp_micros); | 43 token->set_timestamp_micros(timestamp_micros); |
42 token->mutable_hash()->assign(hash); | 44 token->mutable_hash()->assign(hash); |
43 } | 45 } |
44 | 46 |
45 // DeterministicMockData defines the exact sequence of the read/write | 47 // DeterministicMockData defines the exact sequence of the read/write |
46 // operations (specified by the last parameter of MockRead/MockWrite). | 48 // operations (specified by the last parameter of MockRead/MockWrite). |
47 // |io_mode_write| is the IO mode for writing only. Reading is always async. | 49 // |io_mode_write| is the IO mode for writing only. Reading is always async. |
48 void MakeDeterministicMockData(uint32 max_tests, | 50 void MakeDeterministicMockData(uint32 max_tests, |
49 uint32 max_probe_packets, | 51 uint32 max_probe_packets, |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 TestStartOneTest( | 401 TestStartOneTest( |
400 false, NetworkStats::PACKET_SIZE_TEST, 1500, 0, 1, net::SYNCHRONOUS); | 402 false, NetworkStats::PACKET_SIZE_TEST, 1500, 0, 1, net::SYNCHRONOUS); |
401 } | 403 } |
402 | 404 |
403 TEST_F(NetworkStatsTest, StartPacketSizeTest1500BHasNoProxy) { | 405 TEST_F(NetworkStatsTest, StartPacketSizeTest1500BHasNoProxy) { |
404 TestStartOneTest( | 406 TestStartOneTest( |
405 false, NetworkStats::PACKET_SIZE_TEST, 1500, 0, 1, net::ASYNC); | 407 false, NetworkStats::PACKET_SIZE_TEST, 1500, 0, 1, net::ASYNC); |
406 } | 408 } |
407 | 409 |
408 } // namespace chrome_browser_net | 410 } // namespace chrome_browser_net |
OLD | NEW |