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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "chrome/browser/net/network_stats.h" | 7 #include "chrome/browser/net/network_stats.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "net/base/network_change_notifier.h" | 9 #include "net/base/network_change_notifier.h" |
10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
11 #include "net/dns/host_resolver.h" | 11 #include "net/dns/host_resolver.h" |
12 #include "net/dns/mock_host_resolver.h" | 12 #include "net/dns/mock_host_resolver.h" |
13 #include "net/socket/socket_test_util.h" | 13 #include "net/socket/socket_test_util.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
16 | 16 |
17 namespace chrome_browser_net { | 17 namespace chrome_browser_net { |
18 | 18 |
19 class NetworkStatsTest : public PlatformTest { | 19 class NetworkStatsTest : public PlatformTest { |
20 public: | 20 public: |
21 NetworkStatsTest() {} | 21 NetworkStatsTest() {} |
22 | 22 |
23 protected: | 23 protected: |
24 | 24 void SetUp() override { |
25 virtual void SetUp() { | |
26 net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); | 25 net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); |
27 base::MessageLoop::current()->RunUntilIdle(); | 26 base::MessageLoop::current()->RunUntilIdle(); |
28 mock_writes_.clear(); | 27 mock_writes_.clear(); |
29 mock_reads_.clear(); | 28 mock_reads_.clear(); |
30 } | 29 } |
31 | 30 |
32 virtual void TearDown() { | 31 void TearDown() override { |
33 net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); | 32 net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); |
34 // Empty the current queue. | 33 // Empty the current queue. |
35 base::MessageLoop::current()->RunUntilIdle(); | 34 base::MessageLoop::current()->RunUntilIdle(); |
36 PlatformTest::TearDown(); | 35 PlatformTest::TearDown(); |
37 } | 36 } |
38 | 37 |
39 void CreateToken(uint64 timestamp_micros, | 38 void CreateToken(uint64 timestamp_micros, |
40 const string& hash, | 39 const string& hash, |
41 ProbePacket_Token* token) { | 40 ProbePacket_Token* token) { |
42 token->set_timestamp_micros(timestamp_micros); | 41 token->set_timestamp_micros(timestamp_micros); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 TestStartOneTest( | 399 TestStartOneTest( |
401 false, NetworkStats::PACKET_SIZE_TEST, 1500, 0, 1, net::SYNCHRONOUS); | 400 false, NetworkStats::PACKET_SIZE_TEST, 1500, 0, 1, net::SYNCHRONOUS); |
402 } | 401 } |
403 | 402 |
404 TEST_F(NetworkStatsTest, StartPacketSizeTest1500BHasNoProxy) { | 403 TEST_F(NetworkStatsTest, StartPacketSizeTest1500BHasNoProxy) { |
405 TestStartOneTest( | 404 TestStartOneTest( |
406 false, NetworkStats::PACKET_SIZE_TEST, 1500, 0, 1, net::ASYNC); | 405 false, NetworkStats::PACKET_SIZE_TEST, 1500, 0, 1, net::ASYNC); |
407 } | 406 } |
408 | 407 |
409 } // namespace chrome_browser_net | 408 } // namespace chrome_browser_net |
OLD | NEW |