| 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/download/download_crx_util.h" | 5 #include "chrome/browser/download/download_crx_util.h" |
| 6 #include "chrome/browser/download/download_service.h" | 6 #include "chrome/browser/download/download_service.h" |
| 7 #include "chrome/browser/download/download_service_factory.h" | 7 #include "chrome/browser/download/download_service_factory.h" |
| 8 #include "chrome/browser/download/download_test_observer.h" | 8 #include "chrome/browser/download/download_test_observer.h" |
| 9 #include "chrome/browser/extensions/crx_installer.h" | 9 #include "chrome/browser/extensions/crx_installer.h" |
| 10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 MockInstallPrompt* mock_install_prompt) { | 85 MockInstallPrompt* mock_install_prompt) { |
| 86 ExtensionService* service = browser()->profile()->GetExtensionService(); | 86 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 87 FilePath ext_path = test_data_dir_.AppendASCII(ext_relpath); | 87 FilePath ext_path = test_data_dir_.AppendASCII(ext_relpath); |
| 88 | 88 |
| 89 std::string error; | 89 std::string error; |
| 90 base::DictionaryValue* parsed_manifest = | 90 base::DictionaryValue* parsed_manifest = |
| 91 extension_file_util::LoadManifest(ext_path, &error); | 91 extension_file_util::LoadManifest(ext_path, &error); |
| 92 if (!parsed_manifest) | 92 if (!parsed_manifest) |
| 93 return scoped_refptr<CrxInstaller>(); | 93 return scoped_refptr<CrxInstaller>(); |
| 94 | 94 |
| 95 scoped_ptr<WebstoreInstaller::Approval> approval; | 95 scoped_ptr<extensions::WebstoreInstaller::Approval> approval; |
| 96 if (!id.empty()) { | 96 if (!id.empty()) { |
| 97 approval = WebstoreInstaller::Approval::CreateWithNoInstallPrompt( | 97 approval = |
| 98 browser()->profile(), | 98 extensions::WebstoreInstaller::Approval::CreateWithNoInstallPrompt( |
| 99 id, | 99 browser()->profile(), |
| 100 scoped_ptr<base::DictionaryValue>(parsed_manifest)); | 100 id, |
| 101 scoped_ptr<base::DictionaryValue>(parsed_manifest)); |
| 101 } | 102 } |
| 102 | 103 |
| 103 scoped_refptr<CrxInstaller> installer( | 104 scoped_refptr<CrxInstaller> installer( |
| 104 CrxInstaller::Create(service, | 105 CrxInstaller::Create(service, |
| 105 mock_install_prompt, /* ownership transferred */ | 106 mock_install_prompt, /* ownership transferred */ |
| 106 approval.get() /* keep ownership */)); | 107 approval.get() /* keep ownership */)); |
| 107 installer->set_allow_silent_install(true); | 108 installer->set_allow_silent_install(true); |
| 108 installer->set_is_gallery_install(true); | 109 installer->set_is_gallery_install(true); |
| 109 installer->InstallCrx(PackExtension(ext_path)); | 110 installer->InstallCrx(PackExtension(ext_path)); |
| 110 ui_test_utils::RunMessageLoop(); | 111 ui_test_utils::RunMessageLoop(); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 kTestData[i]; | 267 kTestData[i]; |
| 267 if (kTestData[i]) { | 268 if (kTestData[i]) { |
| 268 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i]; | 269 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i]; |
| 269 } else { | 270 } else { |
| 270 EXPECT_EQ(l10n_util::GetStringUTF16( | 271 EXPECT_EQ(l10n_util::GetStringUTF16( |
| 271 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), | 272 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), |
| 272 mock_prompt->error()) << kTestData[i]; | 273 mock_prompt->error()) << kTestData[i]; |
| 273 } | 274 } |
| 274 } | 275 } |
| 275 } | 276 } |
| OLD | NEW |