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 <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 |
| 11 #include "base/location.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/single_thread_task_runner.h" |
13 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/thread_task_runner_handle.h" |
14 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
15 #include "base/values.h" | 18 #include "base/values.h" |
16 #include "chrome/browser/net/predictor.h" | 19 #include "chrome/browser/net/predictor.h" |
17 #include "chrome/browser/net/url_info.h" | 20 #include "chrome/browser/net/url_info.h" |
18 #include "components/network_hints/common/network_hints_common.h" | 21 #include "components/network_hints/common/network_hints_common.h" |
19 #include "content/public/test/test_browser_thread.h" | 22 #include "content/public/test/test_browser_thread.h" |
20 #include "net/base/address_list.h" | 23 #include "net/base/address_list.h" |
21 #include "net/base/load_flags.h" | 24 #include "net/base/load_flags.h" |
22 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
23 #include "net/base/winsock_init.h" | 26 #include "net/base/winsock_init.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 144 |
142 Predictor testing_master(true, true); | 145 Predictor testing_master(true, true); |
143 testing_master.SetHostResolver(host_resolver.get()); | 146 testing_master.SetHostResolver(host_resolver.get()); |
144 | 147 |
145 GURL localhost("http://localhost:80"); | 148 GURL localhost("http://localhost:80"); |
146 UrlList names; | 149 UrlList names; |
147 names.push_back(localhost); | 150 names.push_back(localhost); |
148 | 151 |
149 testing_master.ResolveList(names, UrlInfo::PAGE_SCAN_MOTIVATED); | 152 testing_master.ResolveList(names, UrlInfo::PAGE_SCAN_MOTIVATED); |
150 | 153 |
151 base::MessageLoop::current()->PostDelayedTask( | 154 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
152 FROM_HERE, | 155 FROM_HERE, base::MessageLoop::QuitClosure(), |
153 base::MessageLoop::QuitClosure(), | |
154 base::TimeDelta::FromMilliseconds(500)); | 156 base::TimeDelta::FromMilliseconds(500)); |
155 base::MessageLoop::current()->Run(); | 157 base::MessageLoop::current()->Run(); |
156 | 158 |
157 EXPECT_FALSE(testing_master.WasFound(localhost)); | 159 EXPECT_FALSE(testing_master.WasFound(localhost)); |
158 | 160 |
159 testing_master.Shutdown(); | 161 testing_master.Shutdown(); |
160 | 162 |
161 // Clean up after ourselves. | 163 // Clean up after ourselves. |
162 base::MessageLoop::current()->RunUntilIdle(); | 164 base::MessageLoop::current()->RunUntilIdle(); |
163 } | 165 } |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 | 834 |
833 // Proxy may not be in use (the PAC script has not yet been evaluated), so the | 835 // Proxy may not be in use (the PAC script has not yet been evaluated), so the |
834 // name has been registered for pre-resolve. | 836 // name has been registered for pre-resolve. |
835 EXPECT_FALSE(testing_master.work_queue_.IsEmpty()); | 837 EXPECT_FALSE(testing_master.work_queue_.IsEmpty()); |
836 | 838 |
837 delete testing_master.proxy_service_; | 839 delete testing_master.proxy_service_; |
838 testing_master.Shutdown(); | 840 testing_master.Shutdown(); |
839 } | 841 } |
840 | 842 |
841 } // namespace chrome_browser_net | 843 } // namespace chrome_browser_net |
OLD | NEW |