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

Side by Side Diff: net/proxy/proxy_config_service_linux_unittest.cc

Issue 1141573002: [net/proxy] Usage of ThreadTaskRunnerHandle & SingleThreadTaskRunner instead of MLP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/proxy/polling_proxy_config_service.cc ('k') | net/proxy/proxy_resolver_v8_tracing.h » ('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/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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/format_macros.h" 15 #include "base/format_macros.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/synchronization/waitable_event.h" 19 #include "base/synchronization/waitable_event.h"
20 #include "base/thread_task_runner_handle.h"
20 #include "base/threading/thread.h" 21 #include "base/threading/thread.h"
21 #include "net/proxy/proxy_config.h" 22 #include "net/proxy/proxy_config.h"
22 #include "net/proxy/proxy_config_service_common_unittest.h" 23 #include "net/proxy/proxy_config_service_common_unittest.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 #include "testing/platform_test.h" 25 #include "testing/platform_test.h"
25 26
26 namespace net { 27 namespace net {
27 namespace { 28 namespace {
28 29
29 // Set of values for all environment variables that we might 30 // Set of values for all environment variables that we might
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 base::Bind(&SynchConfigGetter::CleanUp, base::Unretained(this))); 281 base::Bind(&SynchConfigGetter::CleanUp, base::Unretained(this)));
281 Wait(); 282 Wait();
282 } 283 }
283 284
284 // Does gconf setup and initial fetch of the proxy config, 285 // Does gconf setup and initial fetch of the proxy config,
285 // all on the calling thread (meant to be the thread with the 286 // all on the calling thread (meant to be the thread with the
286 // default glib main loop, which is the UI thread). 287 // default glib main loop, which is the UI thread).
287 void SetupAndInitialFetch() { 288 void SetupAndInitialFetch() {
288 // We pass the mock IO thread as both the IO and file threads. 289 // We pass the mock IO thread as both the IO and file threads.
289 config_service_->SetupAndFetchInitialConfig( 290 config_service_->SetupAndFetchInitialConfig(
290 base::MessageLoopProxy::current(), 291 base::ThreadTaskRunnerHandle::Get(), io_thread_.message_loop_proxy(),
291 io_thread_.message_loop_proxy(),
292 io_thread_.message_loop_proxy()); 292 io_thread_.message_loop_proxy());
293 } 293 }
294 // Synchronously gets the proxy config. 294 // Synchronously gets the proxy config.
295 ProxyConfigService::ConfigAvailability SyncGetLatestProxyConfig( 295 ProxyConfigService::ConfigAvailability SyncGetLatestProxyConfig(
296 ProxyConfig* config) { 296 ProxyConfig* config) {
297 io_thread_.message_loop()->PostTask(FROM_HERE, 297 io_thread_.message_loop()->PostTask(FROM_HERE,
298 base::Bind(&SynchConfigGetter::GetLatestConfigOnIOThread, 298 base::Bind(&SynchConfigGetter::GetLatestConfigOnIOThread,
299 base::Unretained(this))); 299 base::Unretained(this)));
300 Wait(); 300 Wait();
301 *config = proxy_config_; 301 *config = proxy_config_;
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 EXPECT_EQ(ProxyConfigService::CONFIG_VALID, 1603 EXPECT_EQ(ProxyConfigService::CONFIG_VALID,
1604 sync_config_getter.SyncGetLatestProxyConfig(&config)); 1604 sync_config_getter.SyncGetLatestProxyConfig(&config));
1605 EXPECT_TRUE(config.auto_detect()); 1605 EXPECT_TRUE(config.auto_detect());
1606 EXPECT_EQ(GURL(), config.pac_url()); 1606 EXPECT_EQ(GURL(), config.pac_url());
1607 } 1607 }
1608 } 1608 }
1609 1609
1610 } // namespace 1610 } // namespace
1611 1611
1612 } // namespace net 1612 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/polling_proxy_config_service.cc ('k') | net/proxy/proxy_resolver_v8_tracing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698