| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 #include "chrome/browser/extensions/crx_installer.h" | 6 #include "chrome/browser/extensions/crx_installer.h" |
| 7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
| 8 #include "chrome/browser/extensions/extension_install_ui.h" | 8 #include "chrome/browser/extensions/extension_install_ui.h" |
| 9 #include "chrome/browser/extensions/extensions_service.h" | 9 #include "chrome/browser/extensions/extensions_service.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const std::string& id) { | 48 const std::string& id) { |
| 49 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 49 ExtensionsService* service = browser()->profile()->GetExtensionsService(); |
| 50 MockInstallUI* mock_install_ui = new MockInstallUI(browser()->profile()); | 50 MockInstallUI* mock_install_ui = new MockInstallUI(browser()->profile()); |
| 51 | 51 |
| 52 scoped_refptr<CrxInstaller> installer( | 52 scoped_refptr<CrxInstaller> installer( |
| 53 new CrxInstaller(service->install_directory(), | 53 new CrxInstaller(service->install_directory(), |
| 54 service, | 54 service, |
| 55 mock_install_ui /* ownership transferred */)); | 55 mock_install_ui /* ownership transferred */)); |
| 56 | 56 |
| 57 installer->set_allow_silent_install(true); | 57 installer->set_allow_silent_install(true); |
| 58 installer->set_is_gallery_install(true); |
| 58 CrxInstaller::SetWhitelistedInstallId(id); | 59 CrxInstaller::SetWhitelistedInstallId(id); |
| 59 | 60 |
| 60 FilePath crx_path = test_data_dir_.AppendASCII(crx_relpath); | 61 FilePath crx_path = test_data_dir_.AppendASCII(crx_relpath); |
| 61 installer->InstallCrx(crx_path); | 62 installer->InstallCrx(crx_path); |
| 62 ui_test_utils::RunMessageLoop(); | 63 ui_test_utils::RunMessageLoop(); |
| 63 | 64 |
| 64 return mock_install_ui->confirmation_requested(); | 65 return mock_install_ui->confirmation_requested(); |
| 65 } | 66 } |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, Whitelisting) { | 69 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, Whitelisting) { |
| 69 // A regular extension should give no prompt. | 70 // A regular extension should give no prompt. |
| 70 EXPECT_FALSE(DidWhitelistInstallPrompt("good.crx", | 71 EXPECT_FALSE(DidWhitelistInstallPrompt("good.crx", |
| 71 "ldnnhddmnhbkjipkidpdiheffobcpfmf")); | 72 "ldnnhddmnhbkjipkidpdiheffobcpfmf")); |
| 72 #if !defined(OS_CHROMEOS) | 73 #if !defined(OS_CHROMEOS) |
| 73 // An extension with NPAPI should give a prompt. | 74 // An extension with NPAPI should give a prompt. |
| 74 EXPECT_TRUE(DidWhitelistInstallPrompt("uitest/plugins.crx", | 75 EXPECT_TRUE(DidWhitelistInstallPrompt("uitest/plugins.crx", |
| 75 "hdgllgikmikobbofgnabhfimcfoopgnd")); | 76 "hdgllgikmikobbofgnabhfimcfoopgnd")); |
| 76 #endif // !defined(OS_CHROMEOS | 77 #endif // !defined(OS_CHROMEOS) |
| 77 } | 78 } |
| OLD | NEW |