Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chrome/browser/net/dns_probe_service_unittest.cc

Issue 2567623003: Make ERR_ICANN_NAME_COLLISION work for async DNS resolver. (Closed)
Patch Set: address Matt's comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 25 matching lines...) Expand all
36 void Probe() { 36 void Probe() {
37 service_.ProbeDns(base::Bind(&DnsProbeServiceTest::ProbeCallback, 37 service_.ProbeDns(base::Bind(&DnsProbeServiceTest::ProbeCallback,
38 base::Unretained(this))); 38 base::Unretained(this)));
39 } 39 }
40 40
41 void Reset() { 41 void Reset() {
42 callback_called_ = false; 42 callback_called_ = false;
43 } 43 }
44 44
45 protected: 45 protected:
46 void SetRules(MockDnsClientRule::Result system_query_result, 46 void SetRules(MockDnsClientRule::ResultType system_query_result,
47 MockDnsClientRule::Result public_query_result) { 47 MockDnsClientRule::ResultType public_query_result) {
48 service_.SetSystemClientForTesting( 48 service_.SetSystemClientForTesting(
49 CreateMockDnsClientForProbes(system_query_result)); 49 CreateMockDnsClientForProbes(system_query_result));
50 service_.SetPublicClientForTesting( 50 service_.SetPublicClientForTesting(
51 CreateMockDnsClientForProbes(public_query_result)); 51 CreateMockDnsClientForProbes(public_query_result));
52 } 52 }
53 53
54 void RunTest(MockDnsClientRule::Result system_query_result, 54 void RunTest(MockDnsClientRule::ResultType system_query_result,
55 MockDnsClientRule::Result public_query_result, 55 MockDnsClientRule::ResultType public_query_result,
56 DnsProbeStatus expected_result) { 56 DnsProbeStatus expected_result) {
57 Reset(); 57 Reset();
58 SetRules(system_query_result, public_query_result); 58 SetRules(system_query_result, public_query_result);
59 59
60 Probe(); 60 Probe();
61 RunLoop().RunUntilIdle(); 61 RunLoop().RunUntilIdle();
62 EXPECT_TRUE(callback_called_); 62 EXPECT_TRUE(callback_called_);
63 EXPECT_EQ(expected_result, callback_result_); 63 EXPECT_EQ(expected_result, callback_result_);
64 } 64 }
65 65
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Pretend cache expires. 124 // Pretend cache expires.
125 ClearCachedResult(); 125 ClearCachedResult();
126 // New rules should apply, since a new probe should be run. 126 // New rules should apply, since a new probe should be run.
127 RunTest(MockDnsClientRule::TIMEOUT, MockDnsClientRule::TIMEOUT, 127 RunTest(MockDnsClientRule::TIMEOUT, MockDnsClientRule::TIMEOUT,
128 error_page::DNS_PROBE_FINISHED_NO_INTERNET); 128 error_page::DNS_PROBE_FINISHED_NO_INTERNET);
129 } 129 }
130 130
131 } // namespace 131 } // namespace
132 132
133 } // namespace chrome_browser_net 133 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/dns_probe_runner_unittest.cc ('k') | chrome/browser/net/dns_probe_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698