OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <cryptohi.h> | 5 #include <cryptohi.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.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/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 content::BrowserThread::PostTask( | 286 content::BrowserThread::PostTask( |
287 content::BrowserThread::UI, FROM_HERE, done_callback); | 287 content::BrowserThread::UI, FROM_HERE, done_callback); |
288 } | 288 } |
289 | 289 |
290 void SetPolicy() { | 290 void SetPolicy() { |
291 // Extensions that are force-installed come from an update URL, which | 291 // Extensions that are force-installed come from an update URL, which |
292 // defaults to the webstore. Use a mock URL for this test with an update | 292 // defaults to the webstore. Use a mock URL for this test with an update |
293 // manifest that includes the crx file of the test extension. | 293 // manifest that includes the crx file of the test extension. |
294 base::FilePath update_manifest_path = | 294 base::FilePath update_manifest_path = |
295 base::FilePath(kTestExtensionDir).Append(kUpdateManifestFileName); | 295 base::FilePath(kTestExtensionDir).Append(kUpdateManifestFileName); |
296 GURL update_manifest_url( | 296 GURL update_manifest_url(net::URLRequestMockHTTPJob::GetMockUrl( |
297 net::URLRequestMockHTTPJob::GetMockUrl(update_manifest_path)); | 297 update_manifest_path.MaybeAsASCII())); |
298 | 298 |
299 scoped_ptr<base::ListValue> forcelist(new base::ListValue); | 299 scoped_ptr<base::ListValue> forcelist(new base::ListValue); |
300 forcelist->AppendString(base::StringPrintf( | 300 forcelist->AppendString(base::StringPrintf( |
301 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str())); | 301 "%s;%s", kTestExtensionID, update_manifest_url.spec().c_str())); |
302 | 302 |
303 policy::PolicyMap policy; | 303 policy::PolicyMap policy; |
304 policy.Set(policy::key::kExtensionInstallForcelist, | 304 policy.Set(policy::key::kExtensionInstallForcelist, |
305 policy::POLICY_LEVEL_MANDATORY, | 305 policy::POLICY_LEVEL_MANDATORY, |
306 policy::POLICY_SCOPE_MACHINE, | 306 policy::POLICY_SCOPE_MACHINE, |
307 policy::POLICY_SOURCE_CLOUD, | 307 policy::POLICY_SOURCE_CLOUD, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 extensions::ExtensionRegistry* registry = | 378 extensions::ExtensionRegistry* registry = |
379 extensions::ExtensionRegistry::Get(profile()); | 379 extensions::ExtensionRegistry::Get(profile()); |
380 const extensions::Extension* extension = | 380 const extensions::Extension* extension = |
381 GetExtensionByPath(registry->enabled_extensions(), extension_path); | 381 GetExtensionByPath(registry->enabled_extensions(), extension_path); |
382 ASSERT_FALSE(extension->install_warnings().empty()); | 382 ASSERT_FALSE(extension->install_warnings().empty()); |
383 EXPECT_EQ( | 383 EXPECT_EQ( |
384 "'enterprise.platformKeys' is not allowed for specified install " | 384 "'enterprise.platformKeys' is not allowed for specified install " |
385 "location.", | 385 "location.", |
386 extension->install_warnings()[0].message); | 386 extension->install_warnings()[0].message); |
387 } | 387 } |
OLD | NEW |