| 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.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "chrome/browser/net/network_stats.h" | 8 #include "chrome/browser/net/network_stats.h" |
| 9 #include "net/base/host_resolver.h" | 9 #include "net/base/host_resolver.h" |
| 10 #include "net/base/mock_host_resolver.h" | 10 #include "net/base/mock_host_resolver.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 message_loop_.RunUntilIdle(); | 25 message_loop_.RunUntilIdle(); |
| 26 } | 26 } |
| 27 MessageLoopForIO message_loop_; | 27 MessageLoopForIO message_loop_; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 class NetworkStatsTestUDP : public NetworkStatsTest { | 30 class NetworkStatsTestUDP : public NetworkStatsTest { |
| 31 public: | 31 public: |
| 32 NetworkStatsTestUDP() | 32 NetworkStatsTestUDP() |
| 33 : test_server_(net::TestServer::TYPE_UDP_ECHO, | 33 : test_server_(net::TestServer::TYPE_UDP_ECHO, |
| 34 net::TestServer::kLocalhost, | 34 net::TestServer::kLocalhost, |
| 35 base::FilePath(FILE_PATH_LITERAL("net/data"))) { | 35 net::TestServer::GetSourceRelativePath( |
| 36 base::FilePath(FILE_PATH_LITERAL("net/data")))) { |
| 36 } | 37 } |
| 37 | 38 |
| 38 protected: | 39 protected: |
| 39 void RunUDPEchoTest(int bytes, int packets, bool has_proxy) { | 40 void RunUDPEchoTest(int bytes, int packets, bool has_proxy) { |
| 40 net::TestCompletionCallback cb; | 41 net::TestCompletionCallback cb; |
| 41 | 42 |
| 42 scoped_ptr<net::MockHostResolver> host_resolver( | 43 scoped_ptr<net::MockHostResolver> host_resolver( |
| 43 new net::MockHostResolver()); | 44 new net::MockHostResolver()); |
| 44 | 45 |
| 45 // We will use HISTOGRAM_PORT_MAX as the PortIndex enum for testing | 46 // We will use HISTOGRAM_PORT_MAX as the PortIndex enum for testing |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 network_stats.Crypt( | 408 network_stats.Crypt( |
| 408 key, key_string.length(), payload_data, KBytesToSend, encoded_data); | 409 key, key_string.length(), payload_data, KBytesToSend, encoded_data); |
| 409 std::string encoded_payload(encoded_data, KBytesToSend); | 410 std::string encoded_payload(encoded_data, KBytesToSend); |
| 410 | 411 |
| 411 message = version + checksum + payload_size + key_string + encoded_payload; | 412 message = version + checksum + payload_size + key_string + encoded_payload; |
| 412 EXPECT_EQ(NetworkStats::SUCCESS, network_stats.VerifyBytes(message)); | 413 EXPECT_EQ(NetworkStats::SUCCESS, network_stats.VerifyBytes(message)); |
| 413 EXPECT_EQ(1u, network_stats.packets_received_mask()); | 414 EXPECT_EQ(1u, network_stats.packets_received_mask()); |
| 414 } | 415 } |
| 415 | 416 |
| 416 } // namespace chrome_browser_net | 417 } // namespace chrome_browser_net |
| OLD | NEW |