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

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

Issue 10140010: Use base::MessageLoopProxy instead of MessageLoop in ProxyConfigServiceLinux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | net/proxy/proxy_service.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/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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 &values.ignore_hosts; 168 &values.ignore_hosts;
169 Reset(); 169 Reset();
170 } 170 }
171 171
172 // Zeros all environment values. 172 // Zeros all environment values.
173 void Reset() { 173 void Reset() {
174 GConfValues zero_values = { 0 }; 174 GConfValues zero_values = { 0 };
175 values = zero_values; 175 values = zero_values;
176 } 176 }
177 177
178 virtual bool Init(MessageLoop* glib_default_loop, 178 virtual bool Init(base::MessageLoopProxy* glib_default_loop,
179 MessageLoopForIO* file_loop) OVERRIDE { 179 MessageLoopForIO* file_loop) OVERRIDE {
180 return true; 180 return true;
181 } 181 }
182 182
183 virtual void ShutDown() OVERRIDE {} 183 virtual void ShutDown() OVERRIDE {}
184 184
185 virtual bool SetUpNotifications(ProxyConfigServiceLinux::Delegate* delegate) 185 virtual bool SetUpNotifications(ProxyConfigServiceLinux::Delegate* delegate)
186 OVERRIDE { 186 OVERRIDE {
187 return true; 187 return true;
188 } 188 }
189 189
190 virtual MessageLoop* GetNotificationLoop() OVERRIDE { 190 virtual base::MessageLoopProxy* GetNotificationLoop() OVERRIDE {
191 return NULL; 191 return NULL;
192 } 192 }
193 193
194 virtual const char* GetDataSource() OVERRIDE { 194 virtual const char* GetDataSource() OVERRIDE {
195 return "test"; 195 return "test";
196 } 196 }
197 197
198 virtual bool GetString(StringSetting key, std::string* result) OVERRIDE { 198 virtual bool GetString(StringSetting key, std::string* result) OVERRIDE {
199 const char* value = strings_table.Get(key); 199 const char* value = strings_table.Get(key);
200 if (value) { 200 if (value) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 MessageLoop* file_loop = io_thread_.message_loop(); 291 MessageLoop* file_loop = io_thread_.message_loop();
292 DCHECK_EQ(MessageLoop::TYPE_IO, file_loop->type()); 292 DCHECK_EQ(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 MessageLoop::current(), io_thread_.message_loop(), 295 base::MessageLoopProxy::current(), io_thread_.message_loop_proxy(),
296 static_cast<MessageLoopForIO*>(file_loop)); 296 static_cast<MessageLoopForIO*>(file_loop));
297 } 297 }
298 // Synchronously gets the proxy config. 298 // Synchronously gets the proxy config.
299 net::ProxyConfigService::ConfigAvailability SyncGetLatestProxyConfig( 299 net::ProxyConfigService::ConfigAvailability SyncGetLatestProxyConfig(
300 net::ProxyConfig* config) { 300 net::ProxyConfig* config) {
301 io_thread_.message_loop()->PostTask(FROM_HERE, 301 io_thread_.message_loop()->PostTask(FROM_HERE,
302 base::Bind(&SynchConfigGetter::GetLatestConfigOnIOThread, 302 base::Bind(&SynchConfigGetter::GetLatestConfigOnIOThread,
303 base::Unretained(this))); 303 base::Unretained(this)));
304 Wait(); 304 Wait();
305 *config = proxy_config_; 305 *config = proxy_config_;
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 ProxyConfig config; 1541 ProxyConfig config;
1542 sync_config_getter.SetupAndInitialFetch(); 1542 sync_config_getter.SetupAndInitialFetch();
1543 EXPECT_EQ(ProxyConfigService::CONFIG_VALID, 1543 EXPECT_EQ(ProxyConfigService::CONFIG_VALID,
1544 sync_config_getter.SyncGetLatestProxyConfig(&config)); 1544 sync_config_getter.SyncGetLatestProxyConfig(&config));
1545 EXPECT_TRUE(config.auto_detect()); 1545 EXPECT_TRUE(config.auto_detect());
1546 EXPECT_EQ(GURL(), config.pac_url()); 1546 EXPECT_EQ(GURL(), config.pac_url());
1547 } 1547 }
1548 } 1548 }
1549 1549
1550 } // namespace net 1550 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | net/proxy/proxy_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698