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

Side by Side Diff: net/dns/dns_config_service_unittest.cc

Issue 2090613002: Remove calls to deprecated MessageLoop methods in net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « net/disk_cache/disk_cache_test_util.cc ('k') | net/dns/dns_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/dns/dns_config_service.h" 5 #include "net/dns/dns_config_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/run_loop.h"
13 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
14 #include "base/strings/string_split.h" 15 #include "base/strings/string_split.h"
15 #include "base/test/test_timeouts.h" 16 #include "base/test/test_timeouts.h"
16 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
17 #include "net/dns/dns_protocol.h" 18 #include "net/dns/dns_protocol.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 namespace net { 21 namespace net {
21 22
22 namespace { 23 namespace {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 void set_watch_failed(bool value) { 56 void set_watch_failed(bool value) {
56 DnsConfigService::set_watch_failed(value); 57 DnsConfigService::set_watch_failed(value);
57 } 58 }
58 }; 59 };
59 60
60 void WaitForConfig(base::TimeDelta timeout) { 61 void WaitForConfig(base::TimeDelta timeout) {
61 base::CancelableClosure closure(base::MessageLoop::QuitWhenIdleClosure()); 62 base::CancelableClosure closure(base::MessageLoop::QuitWhenIdleClosure());
62 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 63 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
63 FROM_HERE, closure.callback(), timeout); 64 FROM_HERE, closure.callback(), timeout);
64 quit_on_config_ = true; 65 quit_on_config_ = true;
65 base::MessageLoop::current()->Run(); 66 base::RunLoop().Run();
66 quit_on_config_ = false; 67 quit_on_config_ = false;
67 closure.Cancel(); 68 closure.Cancel();
68 } 69 }
69 70
70 // Generate a config using the given seed.. 71 // Generate a config using the given seed..
71 DnsConfig MakeConfig(unsigned seed) { 72 DnsConfig MakeConfig(unsigned seed) {
72 DnsConfig config; 73 DnsConfig config;
73 config.nameservers.push_back( 74 config.nameservers.push_back(
74 IPEndPoint(IPAddress(1, 2, 3, 4), seed & 0xFFFF)); 75 IPEndPoint(IPAddress(1, 2, 3, 4), seed & 0xFFFF));
75 EXPECT_TRUE(config.IsValid()); 76 EXPECT_TRUE(config.IsValid());
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 238
238 last_config_ = bad_config; 239 last_config_ = bad_config;
239 // No change, so no update. 240 // No change, so no update.
240 service_->InvalidateConfig(); 241 service_->InvalidateConfig();
241 service_->OnConfigRead(config2); 242 service_->OnConfigRead(config2);
242 EXPECT_TRUE(last_config_.Equals(bad_config)); 243 EXPECT_TRUE(last_config_.Equals(bad_config));
243 } 244 }
244 245
245 } // namespace net 246 } // namespace net
246 247
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_test_util.cc ('k') | net/dns/dns_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698