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 "net/proxy/proxy_config_service_linux.h" | 5 #include "net/proxy/proxy_config_service_linux.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 } | 285 } |
286 | 286 |
287 // Does gconf setup and initial fetch of the proxy config, | 287 // Does gconf setup and initial fetch of the proxy config, |
288 // all on the calling thread (meant to be the thread with the | 288 // all on the calling thread (meant to be the thread with the |
289 // default glib main loop, which is the UI thread). | 289 // default glib main loop, which is the UI thread). |
290 void SetupAndInitialFetch() { | 290 void SetupAndInitialFetch() { |
291 base::MessageLoop* file_loop = io_thread_.message_loop(); | 291 base::MessageLoop* file_loop = io_thread_.message_loop(); |
292 DCHECK_EQ(base::MessageLoop::TYPE_IO, file_loop->type()); | 292 DCHECK_EQ(base::MessageLoop::TYPE_IO, file_loop->type()); |
293 // We pass the mock IO thread as both the IO and file threads. | 293 // We pass the mock IO thread as both the IO and file threads. |
294 config_service_->SetupAndFetchInitialConfig( | 294 config_service_->SetupAndFetchInitialConfig( |
295 base::MessageLoopProxy::current(), | 295 base::MessageLoopProxy::current().get(), |
296 io_thread_.message_loop_proxy(), | 296 io_thread_.message_loop_proxy().get(), |
297 static_cast<base::MessageLoopForIO*>(file_loop)); | 297 static_cast<base::MessageLoopForIO*>(file_loop)); |
298 } | 298 } |
299 // Synchronously gets the proxy config. | 299 // Synchronously gets the proxy config. |
300 net::ProxyConfigService::ConfigAvailability SyncGetLatestProxyConfig( | 300 net::ProxyConfigService::ConfigAvailability SyncGetLatestProxyConfig( |
301 net::ProxyConfig* config) { | 301 net::ProxyConfig* config) { |
302 io_thread_.message_loop()->PostTask(FROM_HERE, | 302 io_thread_.message_loop()->PostTask(FROM_HERE, |
303 base::Bind(&SynchConfigGetter::GetLatestConfigOnIOThread, | 303 base::Bind(&SynchConfigGetter::GetLatestConfigOnIOThread, |
304 base::Unretained(this))); | 304 base::Unretained(this))); |
305 Wait(); | 305 Wait(); |
306 *config = proxy_config_; | 306 *config = proxy_config_; |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 ProxyConfig config; | 1608 ProxyConfig config; |
1609 sync_config_getter.SetupAndInitialFetch(); | 1609 sync_config_getter.SetupAndInitialFetch(); |
1610 EXPECT_EQ(ProxyConfigService::CONFIG_VALID, | 1610 EXPECT_EQ(ProxyConfigService::CONFIG_VALID, |
1611 sync_config_getter.SyncGetLatestProxyConfig(&config)); | 1611 sync_config_getter.SyncGetLatestProxyConfig(&config)); |
1612 EXPECT_TRUE(config.auto_detect()); | 1612 EXPECT_TRUE(config.auto_detect()); |
1613 EXPECT_EQ(GURL(), config.pac_url()); | 1613 EXPECT_EQ(GURL(), config.pac_url()); |
1614 } | 1614 } |
1615 } | 1615 } |
1616 | 1616 |
1617 } // namespace net | 1617 } // namespace net |
OLD | NEW |