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"
6 #include "chrome/browser/extensions/extension_test_message_listener.h"
8 using extensions::Extension
;
10 // NB: We use LoadExtension instead of InstallExtension for shared modules so
11 // the public-keys in their manifests are used to generate the extension ID, so
12 // it can be imported correctly. We use InstallExtension otherwise so the loads
13 // happen through the CRX installer which validates imports.
15 // Timing out on Win7 Tests bot. See http://crbug.com/395796 .
16 IN_PROC_BROWSER_TEST_F(ExtensionApiTest
, DISABLED_SharedModule
) {
17 // import_pass depends on this shared module.
18 ASSERT_TRUE(LoadExtension(
19 test_data_dir_
.AppendASCII("shared_module").AppendASCII("shared")));
21 EXPECT_TRUE(RunExtensionTest("shared_module/import_pass"));
23 EXPECT_FALSE(InstallExtension(
24 test_data_dir_
.AppendASCII("shared_module")
25 .AppendASCII("import_wrong_version"), 0));
26 EXPECT_FALSE(InstallExtension(
27 test_data_dir_
.AppendASCII("shared_module")
28 .AppendASCII("import_non_existent"), 0));
31 IN_PROC_BROWSER_TEST_F(ExtensionApiTest
, SharedModuleWhitelist
) {
32 ASSERT_TRUE(LoadExtension(
33 test_data_dir_
.AppendASCII("shared_module")
34 .AppendASCII("shared_whitelist")));
36 EXPECT_FALSE(InstallExtension(
37 test_data_dir_
.AppendASCII("shared_module")
38 .AppendASCII("import_not_in_whitelist"), 0));
41 // Timing out on Win7 Tests bot. See http://crbug.com/395796 .
42 IN_PROC_BROWSER_TEST_F(ExtensionApiTest
, DISABLED_SharedModuleInstallEvent
) {
43 ExtensionTestMessageListener
listener1("ready", false);
45 const Extension
* extension
= LoadExtension(
46 test_data_dir_
.AppendASCII("shared_module").AppendASCII("shared"));
47 ASSERT_TRUE(extension
);
48 ASSERT_TRUE(InstallExtension(
49 test_data_dir_
.AppendASCII("shared_module").AppendASCII("import_pass"),
52 EXPECT_TRUE(listener1
.WaitUntilSatisfied());
54 ExtensionTestMessageListener
listener2("shared_module_updated", false);
55 ReloadExtension(extension
->id());
57 EXPECT_TRUE(listener2
.WaitUntilSatisfied());