OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/chromeos/policy/affiliation_test_helper.h" | 7 #include "chrome/browser/chromeos/policy/affiliation_test_helper.h" |
8 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 8 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
9 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 9 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
10 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" | 10 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 GURL update_manifest_url(net::URLRequestMockHTTPJob::GetMockUrl( | 140 GURL update_manifest_url(net::URLRequestMockHTTPJob::GetMockUrl( |
141 update_manifest_path.MaybeAsASCII())); | 141 update_manifest_path.MaybeAsASCII())); |
142 | 142 |
143 std::unique_ptr<base::ListValue> forcelist(new base::ListValue); | 143 std::unique_ptr<base::ListValue> forcelist(new base::ListValue); |
144 forcelist->AppendString(base::StringPrintf( | 144 forcelist->AppendString(base::StringPrintf( |
145 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str())); | 145 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str())); |
146 | 146 |
147 policy::PolicyMap policy; | 147 policy::PolicyMap policy; |
148 policy.Set(policy::key::kExtensionInstallForcelist, | 148 policy.Set(policy::key::kExtensionInstallForcelist, |
149 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE, | 149 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE, |
150 policy::POLICY_SOURCE_CLOUD, forcelist.release(), nullptr); | 150 policy::POLICY_SOURCE_CLOUD, std::move(forcelist), nullptr); |
151 | 151 |
152 // Set the policy and wait until the extension is installed. | 152 // Set the policy and wait until the extension is installed. |
153 extensions::TestExtensionRegistryObserver observer( | 153 extensions::TestExtensionRegistryObserver observer( |
154 ExtensionRegistry::Get(profile())); | 154 ExtensionRegistry::Get(profile())); |
155 policy_provider_.UpdateChromePolicy(policy); | 155 policy_provider_.UpdateChromePolicy(policy); |
156 observer.WaitForExtensionLoaded(); | 156 observer.WaitForExtensionLoaded(); |
157 } | 157 } |
158 | 158 |
159 // Load |page_url| in |browser| and wait for PASSED or FAILED notification. | 159 // Load |page_url| in |browser| and wait for PASSED or FAILED notification. |
160 // The functionality of this function is reduced functionality of | 160 // The functionality of this function is reduced functionality of |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 "'enterprise.deviceAttributes' is not allowed for specified install " | 234 "'enterprise.deviceAttributes' is not allowed for specified install " |
235 "location.", | 235 "location.", |
236 extension->install_warnings()[0].message); | 236 extension->install_warnings()[0].message); |
237 } | 237 } |
238 | 238 |
239 // Both cases of affiliated and non-affiliated on the device user are tested. | 239 // Both cases of affiliated and non-affiliated on the device user are tested. |
240 INSTANTIATE_TEST_CASE_P(AffiliationCheck, | 240 INSTANTIATE_TEST_CASE_P(AffiliationCheck, |
241 EnterpriseDeviceAttributesTest, | 241 EnterpriseDeviceAttributesTest, |
242 ::testing::Values(Params(true), Params(false))); | 242 ::testing::Values(Params(true), Params(false))); |
243 } // namespace extensions | 243 } // namespace extensions |
OLD | NEW |