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

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

Issue 1395103003: Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « chrome/browser/net/predictor_browsertest.cc ('k') | chrome/browser/net/sdch_browsertest.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 <time.h> 5 #include <time.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream> 8 #include <sstream>
9 #include <string> 9 #include <string>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (--checks_until_quit_ > 0) { 54 if (--checks_until_quit_ > 0) {
55 for (UrlList::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i) 55 for (UrlList::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i)
56 if (predictor_->GetResolutionDuration(*i) == 56 if (predictor_->GetResolutionDuration(*i) ==
57 UrlInfo::NullDuration()) 57 UrlInfo::NullDuration())
58 return; // We don't have resolution for that host. 58 return; // We don't have resolution for that host.
59 } 59 }
60 60
61 // When all hostnames have been resolved, or we've hit the limit, 61 // When all hostnames have been resolved, or we've hit the limit,
62 // exit the loop. 62 // exit the loop.
63 timer_->Stop(); 63 timer_->Stop();
64 base::MessageLoop::current()->Quit(); 64 base::MessageLoop::current()->QuitWhenIdle();
65 delete timer_; 65 delete timer_;
66 delete this; 66 delete this;
67 } 67 }
68 68
69 private: 69 private:
70 Predictor* predictor_; 70 Predictor* predictor_;
71 const UrlList hosts_; 71 const UrlList hosts_;
72 base::RepeatingTimer* timer_; 72 base::RepeatingTimer* timer_;
73 int checks_until_quit_; 73 int checks_until_quit_;
74 }; 74 };
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 Predictor testing_master(true, true); 144 Predictor testing_master(true, true);
145 testing_master.SetHostResolver(host_resolver.get()); 145 testing_master.SetHostResolver(host_resolver.get());
146 146
147 GURL localhost("http://localhost:80"); 147 GURL localhost("http://localhost:80");
148 UrlList names; 148 UrlList names;
149 names.push_back(localhost); 149 names.push_back(localhost);
150 150
151 testing_master.ResolveList(names, UrlInfo::PAGE_SCAN_MOTIVATED); 151 testing_master.ResolveList(names, UrlInfo::PAGE_SCAN_MOTIVATED);
152 152
153 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 153 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
154 FROM_HERE, base::MessageLoop::QuitClosure(), 154 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
155 base::TimeDelta::FromMilliseconds(500)); 155 base::TimeDelta::FromMilliseconds(500));
156 base::MessageLoop::current()->Run(); 156 base::MessageLoop::current()->Run();
157 157
158 EXPECT_FALSE(testing_master.WasFound(localhost)); 158 EXPECT_FALSE(testing_master.WasFound(localhost));
159 159
160 testing_master.Shutdown(); 160 testing_master.Shutdown();
161 161
162 // Clean up after ourselves. 162 // Clean up after ourselves.
163 base::MessageLoop::current()->RunUntilIdle(); 163 base::MessageLoop::current()->RunUntilIdle();
164 } 164 }
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED); 837 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED);
838 838
839 // Proxy may not be in use (the PAC script has not yet been evaluated), so the 839 // Proxy may not be in use (the PAC script has not yet been evaluated), so the
840 // name has been registered for pre-resolve. 840 // name has been registered for pre-resolve.
841 EXPECT_FALSE(testing_master.work_queue_.IsEmpty()); 841 EXPECT_FALSE(testing_master.work_queue_.IsEmpty());
842 842
843 testing_master.Shutdown(); 843 testing_master.Shutdown();
844 } 844 }
845 845
846 } // namespace chrome_browser_net 846 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor_browsertest.cc ('k') | chrome/browser/net/sdch_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698