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_service.h" | 5 #include "chrome/browser/net/dns_probe_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 bool system_job_created_; | 82 bool system_job_created_; |
83 bool public_job_created_; | 83 bool public_job_created_; |
84 | 84 |
85 private: | 85 private: |
86 // Override methods in DnsProbeService to return mock jobs: | 86 // Override methods in DnsProbeService to return mock jobs: |
87 | 87 |
88 virtual scoped_ptr<DnsProbeJob> CreateSystemProbeJob( | 88 virtual scoped_ptr<DnsProbeJob> CreateSystemProbeJob( |
89 const DnsProbeJob::CallbackType& job_callback) OVERRIDE { | 89 const DnsProbeJob::CallbackType& job_callback) OVERRIDE { |
90 if (mock_system_fail_) | 90 if (mock_system_fail_) |
91 return scoped_ptr<DnsProbeJob>(NULL); | 91 return scoped_ptr<DnsProbeJob>(); |
92 | 92 |
93 system_job_created_ = true; | 93 system_job_created_ = true; |
94 return scoped_ptr<DnsProbeJob>( | 94 return scoped_ptr<DnsProbeJob>( |
95 new MockDnsProbeJob(job_callback, | 95 new MockDnsProbeJob(job_callback, |
96 mock_system_result_)); | 96 mock_system_result_)); |
97 } | 97 } |
98 | 98 |
99 virtual scoped_ptr<DnsProbeJob> CreatePublicProbeJob( | 99 virtual scoped_ptr<DnsProbeJob> CreatePublicProbeJob( |
100 const DnsProbeJob::CallbackType& job_callback) OVERRIDE { | 100 const DnsProbeJob::CallbackType& job_callback) OVERRIDE { |
101 public_job_created_ = true; | 101 public_job_created_ = true; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 Reset(); | 212 Reset(); |
213 | 213 |
214 RunUntilIdle(); | 214 RunUntilIdle(); |
215 EXPECT_FALSE(callback_called_); | 215 EXPECT_FALSE(callback_called_); |
216 } | 216 } |
217 | 217 |
218 } // namespace | 218 } // namespace |
219 | 219 |
220 } // namespace chrome_browser_net | 220 } // namespace chrome_browser_net |
OLD | NEW |