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

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

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 8 months 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 service_.ClearCachedResultForTesting(); 67 service_.ClearCachedResultForTesting();
68 } 68 }
69 69
70 private: 70 private:
71 void ProbeCallback(DnsProbeStatus result) { 71 void ProbeCallback(DnsProbeStatus result) {
72 EXPECT_FALSE(callback_called_); 72 EXPECT_FALSE(callback_called_);
73 callback_called_ = true; 73 callback_called_ = true;
74 callback_result_ = result; 74 callback_result_ = result;
75 } 75 }
76 76
77 TestBrowserThreadBundle bundle_;
77 DnsProbeService service_; 78 DnsProbeService service_;
78 bool callback_called_; 79 bool callback_called_;
79 DnsProbeStatus callback_result_; 80 DnsProbeStatus callback_result_;
80 TestBrowserThreadBundle bundle_;
81 }; 81 };
82 82
83 TEST_F(DnsProbeServiceTest, Probe_OK_OK) { 83 TEST_F(DnsProbeServiceTest, Probe_OK_OK) {
84 RunTest(MockDnsClientRule::OK, MockDnsClientRule::OK, 84 RunTest(MockDnsClientRule::OK, MockDnsClientRule::OK,
85 chrome_common_net::DNS_PROBE_FINISHED_NXDOMAIN); 85 chrome_common_net::DNS_PROBE_FINISHED_NXDOMAIN);
86 } 86 }
87 87
88 TEST_F(DnsProbeServiceTest, Probe_TIMEOUT_OK) { 88 TEST_F(DnsProbeServiceTest, Probe_TIMEOUT_OK) {
89 RunTest(MockDnsClientRule::TIMEOUT, MockDnsClientRule::OK, 89 RunTest(MockDnsClientRule::TIMEOUT, MockDnsClientRule::OK,
90 chrome_common_net::DNS_PROBE_FINISHED_BAD_CONFIG); 90 chrome_common_net::DNS_PROBE_FINISHED_BAD_CONFIG);
(...skipping 33 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 chrome_common_net::DNS_PROBE_FINISHED_NO_INTERNET); 128 chrome_common_net::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

Powered by Google App Engine
This is Rietveld 408576698