1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/extension_apitest.h"
7 using extensions::Extension
;
9 // NB: We use LoadExtension instead of InstallExtension for shared modules so
10 // the public-keys in their manifests are used to generate the extension ID, so
11 // it can be imported correctly. We use InstallExtension otherwise so the loads
12 // happen through the CRX installer which validates imports.
14 IN_PROC_BROWSER_TEST_F(ExtensionApiTest
, SharedModule
) {
15 // import_pass depends on this shared module.
16 ASSERT_TRUE(LoadExtension(
17 test_data_dir_
.AppendASCII("shared_module").AppendASCII("shared")));
19 EXPECT_TRUE(RunExtensionTest("shared_module/import_pass"));
21 EXPECT_FALSE(InstallExtension(
22 test_data_dir_
.AppendASCII("shared_module")
23 .AppendASCII("import_wrong_version"), 0));
24 EXPECT_FALSE(InstallExtension(
25 test_data_dir_
.AppendASCII("shared_module")
26 .AppendASCII("import_non_existent"), 0));
29 IN_PROC_BROWSER_TEST_F(ExtensionApiTest
, SharedModuleWhitelist
) {
30 ASSERT_TRUE(LoadExtension(
31 test_data_dir_
.AppendASCII("shared_module")
32 .AppendASCII("shared_whitelist")));
34 EXPECT_FALSE(InstallExtension(
35 test_data_dir_
.AppendASCII("shared_module")
36 .AppendASCII("import_not_in_whitelist"), 0));