| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/policy/core/browser/proxy_policy_handler.h" |
| 6 |
| 7 #include <memory> |
| 5 #include <string> | 8 #include <string> |
| 6 | 9 |
| 7 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/ptr_util.h" |
| 8 #include "base/values.h" | 11 #include "base/values.h" |
| 9 #include "components/policy/core/browser/configuration_policy_pref_store.h" | 12 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
| 10 #include "components/policy/core/browser/configuration_policy_pref_store_test.h" | 13 #include "components/policy/core/browser/configuration_policy_pref_store_test.h" |
| 11 #include "components/policy/core/browser/proxy_policy_handler.h" | |
| 12 #include "components/policy/core/common/policy_service_impl.h" | 14 #include "components/policy/core/common/policy_service_impl.h" |
| 13 #include "components/policy/core/common/policy_types.h" | 15 #include "components/policy/core/common/policy_types.h" |
| 14 #include "components/proxy_config/proxy_config_dictionary.h" | 16 #include "components/proxy_config/proxy_config_dictionary.h" |
| 15 #include "components/proxy_config/proxy_config_pref_names.h" | 17 #include "components/proxy_config/proxy_config_pref_names.h" |
| 16 #include "policy/policy_constants.h" | 18 #include "policy/policy_constants.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 20 |
| 19 namespace policy { | 21 namespace policy { |
| 20 | 22 |
| 21 // Test cases for the proxy policy settings. | 23 // Test cases for the proxy policy settings. |
| 22 class ProxyPolicyHandlerTest | 24 class ProxyPolicyHandlerTest |
| 23 : public ConfigurationPolicyPrefStoreTest { | 25 : public ConfigurationPolicyPrefStoreTest { |
| 24 public: | 26 public: |
| 25 void SetUp() override { | 27 void SetUp() override { |
| 26 ConfigurationPolicyPrefStoreTest::SetUp(); | 28 ConfigurationPolicyPrefStoreTest::SetUp(); |
| 27 handler_list_.AddHandler( | 29 handler_list_.AddHandler( |
| 28 make_scoped_ptr<ConfigurationPolicyHandler>(new ProxyPolicyHandler)); | 30 base::WrapUnique<ConfigurationPolicyHandler>(new ProxyPolicyHandler)); |
| 29 // Reset the PolicyServiceImpl to one that has the policy fixup | 31 // Reset the PolicyServiceImpl to one that has the policy fixup |
| 30 // preprocessor. The previous store must be nulled out first so that it | 32 // preprocessor. The previous store must be nulled out first so that it |
| 31 // removes itself from the service's observer list. | 33 // removes itself from the service's observer list. |
| 32 store_ = NULL; | 34 store_ = NULL; |
| 33 policy_service_.reset(new PolicyServiceImpl(providers_)); | 35 policy_service_.reset(new PolicyServiceImpl(providers_)); |
| 34 store_ = new ConfigurationPolicyPrefStore( | 36 store_ = new ConfigurationPolicyPrefStore( |
| 35 policy_service_.get(), &handler_list_, POLICY_LEVEL_MANDATORY); | 37 policy_service_.get(), &handler_list_, POLICY_LEVEL_MANDATORY); |
| 36 } | 38 } |
| 37 | 39 |
| 38 protected: | 40 protected: |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 POLICY_SOURCE_CLOUD, | 347 POLICY_SOURCE_CLOUD, |
| 346 new base::FundamentalValue(i), | 348 new base::FundamentalValue(i), |
| 347 NULL); | 349 NULL); |
| 348 UpdateProviderPolicy(policy); | 350 UpdateProviderPolicy(policy); |
| 349 const base::Value* value = NULL; | 351 const base::Value* value = NULL; |
| 350 EXPECT_FALSE(store_->GetValue(proxy_config::prefs::kProxy, &value)); | 352 EXPECT_FALSE(store_->GetValue(proxy_config::prefs::kProxy, &value)); |
| 351 } | 353 } |
| 352 } | 354 } |
| 353 | 355 |
| 354 } // namespace policy | 356 } // namespace policy |
| OLD | NEW |