OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 #include "chrome/browser/extensions/extension_test_message_listener.h" |
6 | 7 |
7 using extensions::Extension; | 8 using extensions::Extension; |
8 | 9 |
9 // NB: We use LoadExtension instead of InstallExtension for shared modules so | 10 // 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 // 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 // it can be imported correctly. We use InstallExtension otherwise so the loads |
12 // happen through the CRX installer which validates imports. | 13 // happen through the CRX installer which validates imports. |
13 | 14 |
14 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, SharedModule) { | 15 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, SharedModule) { |
15 // import_pass depends on this shared module. | 16 // import_pass depends on this shared module. |
(...skipping 12 matching lines...) Expand all Loading... |
28 | 29 |
29 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, SharedModuleWhitelist) { | 30 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, SharedModuleWhitelist) { |
30 ASSERT_TRUE(LoadExtension( | 31 ASSERT_TRUE(LoadExtension( |
31 test_data_dir_.AppendASCII("shared_module") | 32 test_data_dir_.AppendASCII("shared_module") |
32 .AppendASCII("shared_whitelist"))); | 33 .AppendASCII("shared_whitelist"))); |
33 | 34 |
34 EXPECT_FALSE(InstallExtension( | 35 EXPECT_FALSE(InstallExtension( |
35 test_data_dir_.AppendASCII("shared_module") | 36 test_data_dir_.AppendASCII("shared_module") |
36 .AppendASCII("import_not_in_whitelist"), 0)); | 37 .AppendASCII("import_not_in_whitelist"), 0)); |
37 } | 38 } |
| 39 |
| 40 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, SharedModuleInstallEvent) { |
| 41 ExtensionTestMessageListener listener1("ready", false); |
| 42 |
| 43 const Extension* extension = LoadExtension( |
| 44 test_data_dir_.AppendASCII("shared_module").AppendASCII("shared")); |
| 45 ASSERT_TRUE(extension); |
| 46 ASSERT_TRUE(InstallExtension( |
| 47 test_data_dir_.AppendASCII("shared_module").AppendASCII("import_pass"), |
| 48 1)); |
| 49 |
| 50 EXPECT_TRUE(listener1.WaitUntilSatisfied()); |
| 51 |
| 52 ExtensionTestMessageListener listener2("shared_module_updated", false); |
| 53 ReloadExtension(extension->id()); |
| 54 |
| 55 EXPECT_TRUE(listener2.WaitUntilSatisfied()); |
| 56 } |
OLD | NEW |