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/chromeos/policy/browser_policy_connector_chromeos.h" | 6 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
7 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 7 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
8 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" | 8 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/net/url_request_mock_util.h" | 10 #include "chrome/browser/net/url_request_mock_util.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 SetPolicy(); | 88 SetPolicy(); |
89 } | 89 } |
90 | 90 |
91 private: | 91 private: |
92 void SetPolicy() { | 92 void SetPolicy() { |
93 // Extensions that are force-installed come from an update URL, which | 93 // Extensions that are force-installed come from an update URL, which |
94 // defaults to the webstore. Use a mock URL for this test with an update | 94 // defaults to the webstore. Use a mock URL for this test with an update |
95 // manifest that includes the crx file of the test extension. | 95 // manifest that includes the crx file of the test extension. |
96 base::FilePath update_manifest_path = | 96 base::FilePath update_manifest_path = |
97 base::FilePath(kTestExtensionDir).Append(kUpdateManifestFileName); | 97 base::FilePath(kTestExtensionDir).Append(kUpdateManifestFileName); |
98 GURL update_manifest_url( | 98 GURL update_manifest_url(net::URLRequestMockHTTPJob::GetMockUrl( |
99 net::URLRequestMockHTTPJob::GetMockUrl(update_manifest_path)); | 99 update_manifest_path.MaybeAsASCII())); |
100 | 100 |
101 scoped_ptr<base::ListValue> forcelist(new base::ListValue); | 101 scoped_ptr<base::ListValue> forcelist(new base::ListValue); |
102 forcelist->AppendString(base::StringPrintf( | 102 forcelist->AppendString(base::StringPrintf( |
103 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str())); | 103 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str())); |
104 | 104 |
105 policy::PolicyMap policy; | 105 policy::PolicyMap policy; |
106 policy.Set(policy::key::kExtensionInstallForcelist, | 106 policy.Set(policy::key::kExtensionInstallForcelist, |
107 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE, | 107 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE, |
108 policy::POLICY_SOURCE_CLOUD, forcelist.release(), nullptr); | 108 policy::POLICY_SOURCE_CLOUD, forcelist.release(), nullptr); |
109 | 109 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 const extensions::Extension* extension = | 175 const extensions::Extension* extension = |
176 GetExtensionByPath(registry->enabled_extensions(), extension_path); | 176 GetExtensionByPath(registry->enabled_extensions(), extension_path); |
177 ASSERT_FALSE(extension->install_warnings().empty()); | 177 ASSERT_FALSE(extension->install_warnings().empty()); |
178 EXPECT_EQ( | 178 EXPECT_EQ( |
179 "'enterprise.deviceAttributes' is not allowed for specified install " | 179 "'enterprise.deviceAttributes' is not allowed for specified install " |
180 "location.", | 180 "location.", |
181 extension->install_warnings()[0].message); | 181 extension->install_warnings()[0].message); |
182 } | 182 } |
183 | 183 |
184 } // namespace extensions | 184 } // namespace extensions |
OLD | NEW |