OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 6 #include "base/message_loop.h" |
7 #include "chrome/browser/net/network_stats.h" | 7 #include "chrome/browser/net/network_stats.h" |
8 #include "net/base/host_resolver.h" | 8 #include "net/base/host_resolver.h" |
9 #include "net/base/mock_host_resolver.h" | 9 #include "net/base/mock_host_resolver.h" |
10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
11 #include "net/test/test_server.h" | 11 #include "net/test/test_server.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
14 | 14 |
15 namespace chrome_browser_net { | 15 namespace chrome_browser_net { |
16 | 16 |
17 class NetworkStatsTest : public PlatformTest { | 17 class NetworkStatsTest : public PlatformTest { |
18 public: | 18 public: |
19 NetworkStatsTest() {} | 19 NetworkStatsTest() {} |
20 protected: | 20 protected: |
21 virtual void TearDown() { | 21 virtual void TearDown() { |
22 // Flush the message loop to make Purify happy. | 22 // Flush the message loop to make application verifiers happy. |
23 message_loop_.RunAllPending(); | 23 message_loop_.RunAllPending(); |
24 } | 24 } |
25 MessageLoopForIO message_loop_; | 25 MessageLoopForIO message_loop_; |
26 }; | 26 }; |
27 | 27 |
28 class NetworkStatsTestUDP : public NetworkStatsTest { | 28 class NetworkStatsTestUDP : public NetworkStatsTest { |
29 public: | 29 public: |
30 NetworkStatsTestUDP() | 30 NetworkStatsTestUDP() |
31 : test_server_(net::TestServer::TYPE_UDP_ECHO, | 31 : test_server_(net::TestServer::TYPE_UDP_ECHO, |
32 FilePath(FILE_PATH_LITERAL("net/data"))) { | 32 FilePath(FILE_PATH_LITERAL("net/data"))) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 ASSERT_TRUE(test_server_.Start()); | 90 ASSERT_TRUE(test_server_.Start()); |
91 RunTCPEchoTest(50); | 91 RunTCPEchoTest(50); |
92 } | 92 } |
93 | 93 |
94 TEST_F(NetworkStatsTestTCP, TCPEcho_1K_Of_Data) { | 94 TEST_F(NetworkStatsTestTCP, TCPEcho_1K_Of_Data) { |
95 ASSERT_TRUE(test_server_.Start()); | 95 ASSERT_TRUE(test_server_.Start()); |
96 RunTCPEchoTest(1024); | 96 RunTCPEchoTest(1024); |
97 } | 97 } |
98 | 98 |
99 } // namespace chrome_browser_net | 99 } // namespace chrome_browser_net |
OLD | NEW |