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

Side by Side Diff: chrome/browser/chromeos/proxy_config_service_impl_unittest.cc

Issue 946533003: Fix proxy from user policy on shared networks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment. Created 5 years, 10 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/chromeos/proxy_config_service_impl.cc ('k') | no next file » | 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 "chrome/browser/chromeos/proxy_config_service_impl.h" 5 #include "chrome/browser/chromeos/proxy_config_service_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/prefs/testing_pref_service.h" 13 #include "base/prefs/testing_pref_service.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "chrome/browser/chromeos/net/proxy_config_handler.h"
15 #include "chrome/browser/chromeos/settings/cros_settings.h" 16 #include "chrome/browser/chromeos/settings/cros_settings.h"
16 #include "chrome/browser/chromeos/settings/device_settings_service.h" 17 #include "chrome/browser/chromeos/settings/device_settings_service.h"
17 #include "chrome/browser/chromeos/ui_proxy_config.h" 18 #include "chrome/browser/chromeos/ui_proxy_config.h"
18 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
19 #include "chromeos/dbus/dbus_thread_manager.h" 20 #include "chromeos/dbus/dbus_thread_manager.h"
20 #include "chromeos/dbus/shill_profile_client.h" 21 #include "chromeos/dbus/shill_profile_client.h"
21 #include "chromeos/dbus/shill_service_client.h" 22 #include "chromeos/dbus/shill_service_client.h"
22 #include "chromeos/network/network_handler.h" 23 #include "chromeos/network/network_handler.h"
24 #include "chromeos/network/network_profile_handler.h"
23 #include "chromeos/network/network_state.h" 25 #include "chromeos/network/network_state.h"
24 #include "chromeos/network/network_state_handler.h" 26 #include "chromeos/network/network_state_handler.h"
27 #include "chromeos/network/onc/onc_utils.h"
28 #include "components/pref_registry/testing_pref_service_syncable.h"
25 #include "content/public/test/test_browser_thread.h" 29 #include "content/public/test/test_browser_thread.h"
30 #include "net/proxy/proxy_config.h"
26 #include "net/proxy/proxy_config_service_common_unittest.h" 31 #include "net/proxy/proxy_config_service_common_unittest.h"
27 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
28 #include "third_party/cros_system_api/dbus/service_constants.h" 33 #include "third_party/cros_system_api/dbus/service_constants.h"
29 34
30 using content::BrowserThread; 35 using content::BrowserThread;
31 36
32 namespace chromeos { 37 namespace chromeos {
33 38
34 namespace { 39 namespace {
35 40
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // Expected result. 202 // Expected result.
198 false, // auto_detect 203 false, // auto_detect
199 GURL(), // pac_url 204 GURL(), // pac_url
200 net::ProxyRulesExpectation::Single( // proxy_rules 205 net::ProxyRulesExpectation::Single( // proxy_rules
201 "www.google.com:80", // single proxy 206 "www.google.com:80", // single proxy
202 // bypass_rules 207 // bypass_rules
203 "*.google.com,*foo.com:99,1.2.3.4:22,127.0.0.1/8,<local>"), 208 "*.google.com,*foo.com:99,1.2.3.4:22,127.0.0.1/8,<local>"),
204 }, 209 },
205 }; // tests 210 }; // tests
206 211
212 const char kEthernetPolicy[] =
213 " { \"GUID\": \"{485d6076-dd44-6b6d-69787465725f5040}\","
214 " \"Type\": \"Ethernet\","
215 " \"Name\": \"MyEthernet\","
216 " \"Ethernet\": {"
217 " \"Authentication\": \"None\" },"
218 " \"ProxySettings\": {"
219 " \"PAC\": \"http://domain.com/x\","
220 " \"Type\": \"PAC\" }"
221 " }";
222
207 const char kUserProfilePath[] = "user_profile"; 223 const char kUserProfilePath[] = "user_profile";
208 224
209 } // namespace 225 } // namespace
210 226
211 class ProxyConfigServiceImplTest : public testing::Test { 227 class ProxyConfigServiceImplTest : public testing::Test {
212 protected: 228 protected:
213 ProxyConfigServiceImplTest() 229 ProxyConfigServiceImplTest()
214 : ui_thread_(BrowserThread::UI, &loop_), 230 : ui_thread_(BrowserThread::UI, &loop_),
215 io_thread_(BrowserThread::IO, &loop_) {} 231 io_thread_(BrowserThread::IO, &loop_) {}
216 232
217 void SetUp() override { 233 void SetUp() override {
218 DBusThreadManager::Initialize(); 234 DBusThreadManager::Initialize();
219 NetworkHandler::Initialize(); 235 NetworkHandler::Initialize();
220 236
221 SetUpNetwork(); 237 PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service_.registry());
238 chromeos::proxy_config::RegisterPrefs(pref_service_.registry());
239 PrefProxyConfigTrackerImpl::RegisterProfilePrefs(profile_prefs_.registry());
240 chromeos::proxy_config::RegisterProfilePrefs(profile_prefs_.registry());
241 }
222 242
223 PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service_.registry()); 243 void SetUpProxyConfigService(PrefService* profile_prefs) {
224
225 // Create a ProxyConfigServiceImpl like for the system request context.
226 config_service_impl_.reset( 244 config_service_impl_.reset(
227 new ProxyConfigServiceImpl(NULL, // no profile prefs 245 new ProxyConfigServiceImpl(profile_prefs, &pref_service_));
228 &pref_service_));
229 proxy_config_service_ = 246 proxy_config_service_ =
230 config_service_impl_->CreateTrackingProxyConfigService( 247 config_service_impl_->CreateTrackingProxyConfigService(
231 scoped_ptr<net::ProxyConfigService>()); 248 scoped_ptr<net::ProxyConfigService>());
232 249
233 // CreateTrackingProxyConfigService triggers update of initial prefs proxy 250 // CreateTrackingProxyConfigService triggers update of initial prefs proxy
234 // config by tracker to chrome proxy config service, so flush all pending 251 // config by tracker to chrome proxy config service, so flush all pending
235 // tasks so that tests start fresh. 252 // tasks so that tests start fresh.
236 loop_.RunUntilIdle(); 253 loop_.RunUntilIdle();
237 } 254 }
238 255
239 void SetUpNetwork() { 256 void SetUpPrivateWiFi() {
240 ShillProfileClient::TestInterface* profile_test = 257 ShillProfileClient::TestInterface* profile_test =
241 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface(); 258 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface();
242 ShillServiceClient::TestInterface* service_test = 259 ShillServiceClient::TestInterface* service_test =
243 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); 260 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface();
244 261
245 // Process any pending notifications before clearing services. 262 // Process any pending notifications before clearing services.
246 loop_.RunUntilIdle(); 263 loop_.RunUntilIdle();
247 service_test->ClearServices(); 264 service_test->ClearServices();
248 265
249 // Sends a notification about the added profile. 266 // Sends a notification about the added profile.
250 profile_test->AddProfile(kUserProfilePath, "user_hash"); 267 profile_test->AddProfile(kUserProfilePath, "user_hash");
251 268
252 service_test->AddService("/service/stub_wifi2", 269 service_test->AddService("/service/stub_wifi2",
253 "stub_wifi2" /* guid */, 270 "stub_wifi2" /* guid */,
254 "wifi2_PSK", 271 "wifi2_PSK",
255 shill::kTypeWifi, shill::kStateOnline, 272 shill::kTypeWifi, shill::kStateOnline,
256 true /* visible */); 273 true /* visible */);
257 profile_test->AddService(kUserProfilePath, "/service/stub_wifi2"); 274 profile_test->AddService(kUserProfilePath, "/service/stub_wifi2");
258 275
259 loop_.RunUntilIdle(); 276 loop_.RunUntilIdle();
260 } 277 }
261 278
279 void SetUpSharedEthernet() {
280 ShillProfileClient::TestInterface* profile_test =
281 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface();
282 ShillServiceClient::TestInterface* service_test =
283 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface();
284
285 // Process any pending notifications before clearing services.
286 loop_.RunUntilIdle();
287 service_test->ClearServices();
288
289 // Sends a notification about the added profile.
290 profile_test->AddProfile(kUserProfilePath, "user_hash");
291
292 service_test->AddService("/service/ethernet", "stub_ethernet" /* guid */,
293 "eth0", shill::kTypeEthernet, shill::kStateOnline,
294 true /* visible */);
295 profile_test->AddService(NetworkProfileHandler::GetSharedProfilePath(),
296 "/service/ethernet");
297
298 loop_.RunUntilIdle();
299 }
300
262 void TearDown() override { 301 void TearDown() override {
263 config_service_impl_->DetachFromPrefService(); 302 config_service_impl_->DetachFromPrefService();
264 loop_.RunUntilIdle(); 303 loop_.RunUntilIdle();
265 config_service_impl_.reset(); 304 config_service_impl_.reset();
266 proxy_config_service_.reset(); 305 proxy_config_service_.reset();
267 NetworkHandler::Shutdown(); 306 NetworkHandler::Shutdown();
268 DBusThreadManager::Shutdown(); 307 DBusThreadManager::Shutdown();
269 } 308 }
270 309
271 void InitConfigWithTestInput(const Input& input, 310 void InitConfigWithTestInput(const Input& input,
272 base::DictionaryValue* result) { 311 base::DictionaryValue* result) {
273 base::DictionaryValue* new_config = NULL; 312 scoped_ptr<base::DictionaryValue> new_config;
274 switch (input.mode) { 313 switch (input.mode) {
275 case MK_MODE(DIRECT): 314 case MK_MODE(DIRECT):
276 new_config = ProxyConfigDictionary::CreateDirect(); 315 new_config.reset(ProxyConfigDictionary::CreateDirect());
277 break; 316 break;
278 case MK_MODE(AUTO_DETECT): 317 case MK_MODE(AUTO_DETECT):
279 new_config = ProxyConfigDictionary::CreateAutoDetect(); 318 new_config.reset(ProxyConfigDictionary::CreateAutoDetect());
280 break; 319 break;
281 case MK_MODE(PAC_SCRIPT): 320 case MK_MODE(PAC_SCRIPT):
282 new_config = 321 new_config.reset(
283 ProxyConfigDictionary::CreatePacScript(input.pac_url, false); 322 ProxyConfigDictionary::CreatePacScript(input.pac_url, false));
284 break; 323 break;
285 case MK_MODE(SINGLE_PROXY): 324 case MK_MODE(SINGLE_PROXY):
286 case MK_MODE(PROXY_PER_SCHEME): 325 case MK_MODE(PROXY_PER_SCHEME):
287 new_config = 326 new_config.reset(ProxyConfigDictionary::CreateFixedServers(
288 ProxyConfigDictionary::CreateFixedServers(input.server, 327 input.server, input.bypass_rules));
289 input.bypass_rules);
290 break; 328 break;
291 } 329 }
292 result->Swap(new_config); 330 result->Swap(new_config.get());
293 delete new_config;
294 } 331 }
295 332
296 void SetConfig(base::DictionaryValue* pref_proxy_config_dict) { 333 void SetUserConfigInShill(base::DictionaryValue* pref_proxy_config_dict) {
297 std::string proxy_config; 334 std::string proxy_config;
298 if (pref_proxy_config_dict) 335 if (pref_proxy_config_dict)
299 base::JSONWriter::Write(pref_proxy_config_dict, &proxy_config); 336 base::JSONWriter::Write(pref_proxy_config_dict, &proxy_config);
300 337
301 NetworkStateHandler* network_state_handler = 338 NetworkStateHandler* network_state_handler =
302 NetworkHandler::Get()->network_state_handler(); 339 NetworkHandler::Get()->network_state_handler();
303 const NetworkState* network = network_state_handler->DefaultNetwork(); 340 const NetworkState* network = network_state_handler->DefaultNetwork();
304 ASSERT_TRUE(network); 341 ASSERT_TRUE(network);
305 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface()-> 342 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface()->
306 SetServiceProperty(network->path(), 343 SetServiceProperty(network->path(),
(...skipping 11 matching lines...) Expand all
318 net::ProxyConfigService::ConfigAvailability availability = 355 net::ProxyConfigService::ConfigAvailability availability =
319 proxy_config_service_->GetLatestProxyConfig(config); 356 proxy_config_service_->GetLatestProxyConfig(config);
320 357
321 EXPECT_EQ(net::ProxyConfigService::CONFIG_VALID, availability); 358 EXPECT_EQ(net::ProxyConfigService::CONFIG_VALID, availability);
322 } 359 }
323 360
324 base::MessageLoop loop_; 361 base::MessageLoop loop_;
325 scoped_ptr<net::ProxyConfigService> proxy_config_service_; 362 scoped_ptr<net::ProxyConfigService> proxy_config_service_;
326 scoped_ptr<ProxyConfigServiceImpl> config_service_impl_; 363 scoped_ptr<ProxyConfigServiceImpl> config_service_impl_;
327 TestingPrefServiceSimple pref_service_; 364 TestingPrefServiceSimple pref_service_;
365 user_prefs::TestingPrefServiceSyncable profile_prefs_;
328 366
329 private: 367 private:
330 ScopedTestDeviceSettingsService test_device_settings_service_; 368 ScopedTestDeviceSettingsService test_device_settings_service_;
331 ScopedTestCrosSettings test_cros_settings_; 369 ScopedTestCrosSettings test_cros_settings_;
332 content::TestBrowserThread ui_thread_; 370 content::TestBrowserThread ui_thread_;
333 content::TestBrowserThread io_thread_; 371 content::TestBrowserThread io_thread_;
334 }; 372 };
335 373
336 TEST_F(ProxyConfigServiceImplTest, NetworkProxy) { 374 TEST_F(ProxyConfigServiceImplTest, NetworkProxy) {
375 SetUpPrivateWiFi();
376 // Create a ProxyConfigServiceImpl like for the system request context.
377 SetUpProxyConfigService(nullptr /* no profile prefs */);
337 for (size_t i = 0; i < arraysize(tests); ++i) { 378 for (size_t i = 0; i < arraysize(tests); ++i) {
338 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "] %s", i, 379 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "] %s", i,
339 tests[i].description.c_str())); 380 tests[i].description.c_str()));
340 381
341 base::DictionaryValue test_config; 382 base::DictionaryValue test_config;
342 InitConfigWithTestInput(tests[i].input, &test_config); 383 InitConfigWithTestInput(tests[i].input, &test_config);
343 SetConfig(&test_config); 384 SetUserConfigInShill(&test_config);
344 385
345 net::ProxyConfig config; 386 net::ProxyConfig config;
346 SyncGetLatestProxyConfig(&config); 387 SyncGetLatestProxyConfig(&config);
347 388
348 EXPECT_EQ(tests[i].auto_detect, config.auto_detect()); 389 EXPECT_EQ(tests[i].auto_detect, config.auto_detect());
349 EXPECT_EQ(tests[i].pac_url, config.pac_url()); 390 EXPECT_EQ(tests[i].pac_url, config.pac_url());
350 EXPECT_TRUE(tests[i].proxy_rules.Matches(config.proxy_rules())); 391 EXPECT_TRUE(tests[i].proxy_rules.Matches(config.proxy_rules()));
351 } 392 }
352 } 393 }
353 394
354 TEST_F(ProxyConfigServiceImplTest, DynamicPrefsOverride) { 395 TEST_F(ProxyConfigServiceImplTest, DynamicPrefsOverride) {
396 SetUpPrivateWiFi();
397 // Create a ProxyConfigServiceImpl like for the system request context.
398 SetUpProxyConfigService(nullptr /* no profile prefs */);
355 // Groupings of 3 test inputs to use for managed, recommended and network 399 // Groupings of 3 test inputs to use for managed, recommended and network
356 // proxies respectively. Only valid and non-direct test inputs are used. 400 // proxies respectively. Only valid and non-direct test inputs are used.
357 const size_t proxies[][3] = { 401 const size_t proxies[][3] = {
358 { 1, 2, 4, }, 402 { 1, 2, 4, },
359 { 1, 4, 2, }, 403 { 1, 4, 2, },
360 { 4, 2, 1, }, 404 { 4, 2, 1, },
361 { 2, 1, 4, }, 405 { 2, 1, 4, },
362 { 2, 4, 5, }, 406 { 2, 4, 5, },
363 { 2, 5, 4, }, 407 { 2, 5, 4, },
364 { 5, 4, 2, }, 408 { 5, 4, 2, },
(...skipping 24 matching lines...) Expand all
389 433
390 base::DictionaryValue managed_config; 434 base::DictionaryValue managed_config;
391 InitConfigWithTestInput(managed_params.input, &managed_config); 435 InitConfigWithTestInput(managed_params.input, &managed_config);
392 base::DictionaryValue recommended_config; 436 base::DictionaryValue recommended_config;
393 InitConfigWithTestInput(recommended_params.input, &recommended_config); 437 InitConfigWithTestInput(recommended_params.input, &recommended_config);
394 base::DictionaryValue network_config; 438 base::DictionaryValue network_config;
395 InitConfigWithTestInput(network_params.input, &network_config); 439 InitConfigWithTestInput(network_params.input, &network_config);
396 440
397 // Managed proxy pref should take effect over recommended proxy and 441 // Managed proxy pref should take effect over recommended proxy and
398 // non-existent network proxy. 442 // non-existent network proxy.
399 SetConfig(NULL); 443 SetUserConfigInShill(nullptr);
400 pref_service_.SetManagedPref(prefs::kProxy, managed_config.DeepCopy()); 444 pref_service_.SetManagedPref(prefs::kProxy, managed_config.DeepCopy());
401 pref_service_.SetRecommendedPref(prefs::kProxy, 445 pref_service_.SetRecommendedPref(prefs::kProxy,
402 recommended_config.DeepCopy()); 446 recommended_config.DeepCopy());
403 net::ProxyConfig actual_config; 447 net::ProxyConfig actual_config;
404 SyncGetLatestProxyConfig(&actual_config); 448 SyncGetLatestProxyConfig(&actual_config);
405 EXPECT_EQ(managed_params.auto_detect, actual_config.auto_detect()); 449 EXPECT_EQ(managed_params.auto_detect, actual_config.auto_detect());
406 EXPECT_EQ(managed_params.pac_url, actual_config.pac_url()); 450 EXPECT_EQ(managed_params.pac_url, actual_config.pac_url());
407 EXPECT_TRUE(managed_params.proxy_rules.Matches( 451 EXPECT_TRUE(managed_params.proxy_rules.Matches(
408 actual_config.proxy_rules())); 452 actual_config.proxy_rules()));
409 453
410 // Recommended proxy pref should take effect when managed proxy pref is 454 // Recommended proxy pref should take effect when managed proxy pref is
411 // removed. 455 // removed.
412 pref_service_.RemoveManagedPref(prefs::kProxy); 456 pref_service_.RemoveManagedPref(prefs::kProxy);
413 SyncGetLatestProxyConfig(&actual_config); 457 SyncGetLatestProxyConfig(&actual_config);
414 EXPECT_EQ(recommended_params.auto_detect, actual_config.auto_detect()); 458 EXPECT_EQ(recommended_params.auto_detect, actual_config.auto_detect());
415 EXPECT_EQ(recommended_params.pac_url, actual_config.pac_url()); 459 EXPECT_EQ(recommended_params.pac_url, actual_config.pac_url());
416 EXPECT_TRUE(recommended_params.proxy_rules.Matches( 460 EXPECT_TRUE(recommended_params.proxy_rules.Matches(
417 actual_config.proxy_rules())); 461 actual_config.proxy_rules()));
418 462
419 // Network proxy should take take effect over recommended proxy pref. 463 // Network proxy should take take effect over recommended proxy pref.
420 SetConfig(&network_config); 464 SetUserConfigInShill(&network_config);
421 SyncGetLatestProxyConfig(&actual_config); 465 SyncGetLatestProxyConfig(&actual_config);
422 EXPECT_EQ(network_params.auto_detect, actual_config.auto_detect()); 466 EXPECT_EQ(network_params.auto_detect, actual_config.auto_detect());
423 EXPECT_EQ(network_params.pac_url, actual_config.pac_url()); 467 EXPECT_EQ(network_params.pac_url, actual_config.pac_url());
424 EXPECT_TRUE(network_params.proxy_rules.Matches( 468 EXPECT_TRUE(network_params.proxy_rules.Matches(
425 actual_config.proxy_rules())); 469 actual_config.proxy_rules()));
426 470
427 // Managed proxy pref should take effect over network proxy. 471 // Managed proxy pref should take effect over network proxy.
428 pref_service_.SetManagedPref(prefs::kProxy, managed_config.DeepCopy()); 472 pref_service_.SetManagedPref(prefs::kProxy, managed_config.DeepCopy());
429 SyncGetLatestProxyConfig(&actual_config); 473 SyncGetLatestProxyConfig(&actual_config);
430 EXPECT_EQ(managed_params.auto_detect, actual_config.auto_detect()); 474 EXPECT_EQ(managed_params.auto_detect, actual_config.auto_detect());
(...skipping 13 matching lines...) Expand all
444 // Removing recommended proxy pref should have no effect on network proxy. 488 // Removing recommended proxy pref should have no effect on network proxy.
445 pref_service_.RemoveRecommendedPref(prefs::kProxy); 489 pref_service_.RemoveRecommendedPref(prefs::kProxy);
446 SyncGetLatestProxyConfig(&actual_config); 490 SyncGetLatestProxyConfig(&actual_config);
447 EXPECT_EQ(network_params.auto_detect, actual_config.auto_detect()); 491 EXPECT_EQ(network_params.auto_detect, actual_config.auto_detect());
448 EXPECT_EQ(network_params.pac_url, actual_config.pac_url()); 492 EXPECT_EQ(network_params.pac_url, actual_config.pac_url());
449 EXPECT_TRUE(network_params.proxy_rules.Matches( 493 EXPECT_TRUE(network_params.proxy_rules.Matches(
450 actual_config.proxy_rules())); 494 actual_config.proxy_rules()));
451 } 495 }
452 } 496 }
453 497
498 // Tests whether the proxy settings from user policy are used for ethernet even
499 // if 'UseSharedProxies' is set to false.
500 // See https://crbug.com/454966 .
501 TEST_F(ProxyConfigServiceImplTest, SharedEthernetAndUserPolicy) {
502 SetUpSharedEthernet();
503 SetUpProxyConfigService(&profile_prefs_);
504
505 scoped_ptr<base::DictionaryValue> ethernet_policy(
506 chromeos::onc::ReadDictionaryFromJson(kEthernetPolicy));
507
508 scoped_ptr<base::ListValue> network_configs(new base::ListValue);
509 network_configs->Append(ethernet_policy.release());
510
511 profile_prefs_.SetUserPref(prefs::kUseSharedProxies,
512 new base::FundamentalValue(false));
513 profile_prefs_.SetManagedPref(prefs::kOpenNetworkConfiguration,
514 network_configs.release());
515
516 net::ProxyConfig actual_config;
517 SyncGetLatestProxyConfig(&actual_config);
518 net::ProxyConfig expected_config =
519 net::ProxyConfig::CreateFromCustomPacURL(GURL("http://domain.com/x"));
520 EXPECT_TRUE(expected_config.Equals(actual_config));
521 }
522
454 } // namespace chromeos 523 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/proxy_config_service_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698