| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <utility> |
| 7 | 8 |
| 8 #include "base/bind.h" | 9 #include "base/bind.h" |
| 9 #include "base/callback.h" | 10 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 11 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
| 12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 13 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "chrome/browser/chromeos/arc/intent_helper/arc_settings_service.h" | 16 #include "chrome/browser/chromeos/arc/intent_helper/arc_settings_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 shill::kStateOnline, true /* add_to_visible */); | 275 shill::kStateOnline, true /* add_to_visible */); |
| 275 | 276 |
| 276 service_test->SetServiceProperty(service_path, shill::kProfileProperty, | 277 service_test->SetServiceProperty(service_path, shill::kProfileProperty, |
| 277 base::Value(kUserProfilePath)); | 278 base::Value(kUserProfilePath)); |
| 278 RunUntilIdle(); | 279 RunUntilIdle(); |
| 279 } | 280 } |
| 280 | 281 |
| 281 void SetProxyConfigForNetworkService( | 282 void SetProxyConfigForNetworkService( |
| 282 const std::string& service_path, | 283 const std::string& service_path, |
| 283 const base::DictionaryValue* proxy_config) { | 284 const base::DictionaryValue* proxy_config) { |
| 284 ProxyConfigDictionary proxy_config_dict(proxy_config); | 285 ProxyConfigDictionary proxy_config_dict(proxy_config->CreateDeepCopy()); |
| 285 const chromeos::NetworkState* network = chromeos::NetworkHandler::Get() | 286 const chromeos::NetworkState* network = chromeos::NetworkHandler::Get() |
| 286 ->network_state_handler() | 287 ->network_state_handler() |
| 287 ->GetNetworkState(service_path); | 288 ->GetNetworkState(service_path); |
| 288 ASSERT_TRUE(network); | 289 ASSERT_TRUE(network); |
| 289 chromeos::proxy_config::SetProxyConfigForNetwork(proxy_config_dict, | 290 chromeos::proxy_config::SetProxyConfigForNetwork(proxy_config_dict, |
| 290 *network); | 291 *network); |
| 291 } | 292 } |
| 292 | 293 |
| 293 std::unique_ptr<FakeIntentHelperInstance> fake_intent_helper_instance_; | 294 std::unique_ptr<FakeIntentHelperInstance> fake_intent_helper_instance_; |
| 294 | 295 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 base::MakeUnique<base::Value>(ProxyPrefs::kFixedServersProxyModeName), | 503 base::MakeUnique<base::Value>(ProxyPrefs::kFixedServersProxyModeName), |
| 503 nullptr); | 504 nullptr); |
| 504 policy.Set(policy::key::kProxyServer, policy::POLICY_LEVEL_MANDATORY, | 505 policy.Set(policy::key::kProxyServer, policy::POLICY_LEVEL_MANDATORY, |
| 505 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, | 506 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, |
| 506 base::MakeUnique<base::Value>("proxy:8888"), nullptr); | 507 base::MakeUnique<base::Value>("proxy:8888"), nullptr); |
| 507 UpdatePolicy(policy); | 508 UpdatePolicy(policy); |
| 508 | 509 |
| 509 std::unique_ptr<base::DictionaryValue> proxy_config( | 510 std::unique_ptr<base::DictionaryValue> proxy_config( |
| 510 base::MakeUnique<base::DictionaryValue>()); | 511 base::MakeUnique<base::DictionaryValue>()); |
| 511 proxy_config->SetString("mode", ProxyPrefs::kAutoDetectProxyModeName); | 512 proxy_config->SetString("mode", ProxyPrefs::kAutoDetectProxyModeName); |
| 512 ProxyConfigDictionary proxy_config_dict(proxy_config.get()); | 513 ProxyConfigDictionary proxy_config_dict(std::move(proxy_config)); |
| 513 const chromeos::NetworkState* network = chromeos::NetworkHandler::Get() | 514 const chromeos::NetworkState* network = chromeos::NetworkHandler::Get() |
| 514 ->network_state_handler() | 515 ->network_state_handler() |
| 515 ->DefaultNetwork(); | 516 ->DefaultNetwork(); |
| 516 ASSERT_TRUE(network); | 517 ASSERT_TRUE(network); |
| 517 chromeos::proxy_config::SetProxyConfigForNetwork(proxy_config_dict, *network); | 518 chromeos::proxy_config::SetProxyConfigForNetwork(proxy_config_dict, *network); |
| 518 RunUntilIdle(); | 519 RunUntilIdle(); |
| 519 | 520 |
| 520 std::unique_ptr<base::DictionaryValue> expected_proxy_config( | 521 std::unique_ptr<base::DictionaryValue> expected_proxy_config( |
| 521 base::MakeUnique<base::DictionaryValue>()); | 522 base::MakeUnique<base::DictionaryValue>()); |
| 522 expected_proxy_config->SetString("mode", | 523 expected_proxy_config->SetString("mode", |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 ProxyPrefs::kFixedServersProxyModeName); | 670 ProxyPrefs::kFixedServersProxyModeName); |
| 670 expected_proxy_config->SetString("host", "proxy-n300"); | 671 expected_proxy_config->SetString("host", "proxy-n300"); |
| 671 expected_proxy_config->SetInteger("port", 3000); | 672 expected_proxy_config->SetInteger("port", 3000); |
| 672 | 673 |
| 673 EXPECT_EQ(CountProxyBroadcasts(fake_intent_helper_instance_->broadcasts(), | 674 EXPECT_EQ(CountProxyBroadcasts(fake_intent_helper_instance_->broadcasts(), |
| 674 expected_proxy_config.get()), | 675 expected_proxy_config.get()), |
| 675 1); | 676 1); |
| 676 } | 677 } |
| 677 | 678 |
| 678 } // namespace arc | 679 } // namespace arc |
| OLD | NEW |