| 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 "chrome/browser/net/dns_probe_job.h" | 5 #include "chrome/browser/net/dns_probe_job.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "net/base/net_log.h" | 10 #include "net/base/net_log.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 { MockDnsClientRule::OK, | 99 { MockDnsClientRule::OK, |
| 100 MockDnsClientRule::EMPTY, | 100 MockDnsClientRule::EMPTY, |
| 101 DnsProbeJob::SERVERS_CORRECT }, | 101 DnsProbeJob::SERVERS_CORRECT }, |
| 102 { MockDnsClientRule::EMPTY, | 102 { MockDnsClientRule::EMPTY, |
| 103 MockDnsClientRule::EMPTY, | 103 MockDnsClientRule::EMPTY, |
| 104 DnsProbeJob::SERVERS_INCORRECT }, | 104 DnsProbeJob::SERVERS_INCORRECT }, |
| 105 // TODO(ttuttle): Test that triggers QUERY_DNS_ERROR. | 105 // TODO(ttuttle): Test that triggers QUERY_DNS_ERROR. |
| 106 // (Need to add another mock behavior to MockDnsClient.) | 106 // (Need to add another mock behavior to MockDnsClient.) |
| 107 { MockDnsClientRule::FAIL_ASYNC, | 107 { MockDnsClientRule::FAIL_ASYNC, |
| 108 MockDnsClientRule::FAIL_ASYNC, | 108 MockDnsClientRule::FAIL_ASYNC, |
| 109 DnsProbeJob::SERVERS_UNREACHABLE }, | 109 DnsProbeJob::SERVERS_FAILING }, |
| 110 { MockDnsClientRule::FAIL_SYNC, | 110 { MockDnsClientRule::FAIL_SYNC, |
| 111 MockDnsClientRule::FAIL_SYNC, | 111 MockDnsClientRule::FAIL_SYNC, |
| 112 DnsProbeJob::SERVERS_FAILING }, |
| 113 { MockDnsClientRule::TIMEOUT, |
| 114 MockDnsClientRule::TIMEOUT, |
| 112 DnsProbeJob::SERVERS_UNREACHABLE }, | 115 DnsProbeJob::SERVERS_UNREACHABLE }, |
| 113 }; | 116 }; |
| 114 for (size_t i = 0; i < arraysize(kTestCases); i++) { | 117 for (size_t i = 0; i < arraysize(kTestCases); i++) { |
| 115 const TestCase* test_case = &kTestCases[i]; | 118 const TestCase* test_case = &kTestCases[i]; |
| 116 RunProbe(test_case->good_result, test_case->bad_result); | 119 RunProbe(test_case->good_result, test_case->bad_result); |
| 117 EXPECT_TRUE(callback_called_); | 120 EXPECT_TRUE(callback_called_); |
| 118 EXPECT_EQ(test_case->expected_probe_result, callback_result_); | 121 EXPECT_EQ(test_case->expected_probe_result, callback_result_); |
| 119 } | 122 } |
| 120 } | 123 } |
| 121 | 124 |
| 122 } // namespace | 125 } // namespace |
| 123 | 126 |
| 124 } // namespace chrome_browser_net | 127 } // namespace chrome_browser_net |
| OLD | NEW |