OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 class ExtensionCrxInstallerTestWithExperimentalApis | 299 class ExtensionCrxInstallerTestWithExperimentalApis |
300 : public ExtensionCrxInstallerTest { | 300 : public ExtensionCrxInstallerTest { |
301 protected: | 301 protected: |
302 void SetUpCommandLine(base::CommandLine* command_line) override { | 302 void SetUpCommandLine(base::CommandLine* command_line) override { |
303 ExtensionCrxInstallerTest::SetUpCommandLine(command_line); | 303 ExtensionCrxInstallerTest::SetUpCommandLine(command_line); |
304 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 304 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
305 } | 305 } |
306 }; | 306 }; |
307 | 307 |
308 // This test is skipped on ChromeOS because it requires the NPAPI, | |
309 // which is not available on that platform. | |
310 #if !defined(OS_CHROMEOS) | |
311 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, Whitelisting) { | |
312 std::string id = "hdgllgikmikobbofgnabhfimcfoopgnd"; | |
313 ExtensionRegistry* registry = ExtensionRegistry::Get( | |
314 browser()->profile()); | |
315 | |
316 // Even whitelisted extensions with NPAPI should not prompt. | |
317 scoped_ptr<MockPromptProxy> mock_prompt = | |
318 CreateMockPromptProxyForBrowser(browser()); | |
319 InstallWithPrompt("uitest/plugins", id, mock_prompt.get()); | |
320 EXPECT_FALSE(mock_prompt->confirmation_requested()); | |
321 EXPECT_TRUE(registry->enabled_extensions().GetByID(id)); | |
322 } | |
323 #endif | |
324 | |
325 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, | 308 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, |
326 ExperimentalExtensionFromGallery) { | 309 ExperimentalExtensionFromGallery) { |
327 // Gallery-installed extensions should have their experimental permission | 310 // Gallery-installed extensions should have their experimental permission |
328 // preserved, since we allow the Webstore to make that decision. | 311 // preserved, since we allow the Webstore to make that decision. |
329 const Extension* extension = InstallExtensionFromWebstore( | 312 const Extension* extension = InstallExtensionFromWebstore( |
330 test_data_dir_.AppendASCII("experimental.crx"), 1); | 313 test_data_dir_.AppendASCII("experimental.crx"), 1); |
331 ASSERT_TRUE(extension); | 314 ASSERT_TRUE(extension); |
332 EXPECT_TRUE(extension->permissions_data()->HasAPIPermission( | 315 EXPECT_TRUE(extension->permissions_data()->HasAPIPermission( |
333 APIPermission::kExperimental)); | 316 APIPermission::kExperimental)); |
334 } | 317 } |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 EXPECT_TRUE(WaitForCrxInstallerDone()); | 689 EXPECT_TRUE(WaitForCrxInstallerDone()); |
707 const Extension* extension = installer->extension(); | 690 const Extension* extension = installer->extension(); |
708 ASSERT_TRUE(extension); | 691 ASSERT_TRUE(extension); |
709 ASSERT_EQ(extension_id, extension->id()); | 692 ASSERT_EQ(extension_id, extension->id()); |
710 EXPECT_TRUE(ExtensionPrefs::Get(profile())->AllowFileAccess(extension_id)); | 693 EXPECT_TRUE(ExtensionPrefs::Get(profile())->AllowFileAccess(extension_id)); |
711 EXPECT_TRUE(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS); | 694 EXPECT_TRUE(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS); |
712 } | 695 } |
713 } | 696 } |
714 | 697 |
715 } // namespace extensions | 698 } // namespace extensions |
OLD | NEW |