| 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_service_unittest.h" | 5 #include "chrome/browser/extensions/extension_service_unittest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 2184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2195 base::FilePath(), ExtensionCreator::kOverwriteCRX)); | 2195 base::FilePath(), ExtensionCreator::kOverwriteCRX)); |
| 2196 | 2196 |
| 2197 // Try packing with an invalid manifest. | 2197 // Try packing with an invalid manifest. |
| 2198 std::string invalid_manifest_content = "I am not a manifest."; | 2198 std::string invalid_manifest_content = "I am not a manifest."; |
| 2199 ASSERT_TRUE(file_util::WriteFile( | 2199 ASSERT_TRUE(file_util::WriteFile( |
| 2200 temp_dir2.path().Append(extensions::kManifestFilename), | 2200 temp_dir2.path().Append(extensions::kManifestFilename), |
| 2201 invalid_manifest_content.c_str(), invalid_manifest_content.size())); | 2201 invalid_manifest_content.c_str(), invalid_manifest_content.size())); |
| 2202 creator.reset(new ExtensionCreator()); | 2202 creator.reset(new ExtensionCreator()); |
| 2203 ASSERT_FALSE(creator->Run(temp_dir2.path(), crx_path, privkey_path, | 2203 ASSERT_FALSE(creator->Run(temp_dir2.path(), crx_path, privkey_path, |
| 2204 base::FilePath(), ExtensionCreator::kOverwriteCRX)); | 2204 base::FilePath(), ExtensionCreator::kOverwriteCRX)); |
| 2205 |
| 2206 // Try packing with an invalid private key. Should fail. |
| 2207 base::FilePath invalid_private_key = data_dir_.AppendASCII("invalid.pem"); |
| 2208 creator.reset(new ExtensionCreator()); |
| 2209 ASSERT_FALSE(creator->Run(input_directory, crx_path, invalid_private_key, |
| 2210 base::FilePath(), ExtensionCreator::kOverwriteCRX)); |
| 2205 } | 2211 } |
| 2206 | 2212 |
| 2207 // Test Packaging and installing an extension whose name contains punctuation. | 2213 // Test Packaging and installing an extension whose name contains punctuation. |
| 2208 TEST_F(ExtensionServiceTest, PackPunctuatedExtension) { | 2214 TEST_F(ExtensionServiceTest, PackPunctuatedExtension) { |
| 2209 InitializeEmptyExtensionService(); | 2215 InitializeEmptyExtensionService(); |
| 2210 base::FilePath input_directory = data_dir_ | 2216 base::FilePath input_directory = data_dir_ |
| 2211 .AppendASCII("good") | 2217 .AppendASCII("good") |
| 2212 .AppendASCII("Extensions") | 2218 .AppendASCII("Extensions") |
| 2213 .AppendASCII(good0) | 2219 .AppendASCII(good0) |
| 2214 .AppendASCII("1.0.0.0"); | 2220 .AppendASCII("1.0.0.0"); |
| (...skipping 4117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6332 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); | 6338 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); |
| 6333 | 6339 |
| 6334 service_->CheckForExternalUpdates(); | 6340 service_->CheckForExternalUpdates(); |
| 6335 content::WindowedNotificationObserver( | 6341 content::WindowedNotificationObserver( |
| 6336 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 6342 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 6337 content::NotificationService::AllSources()).Wait(); | 6343 content::NotificationService::AllSources()).Wait(); |
| 6338 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); | 6344 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); |
| 6339 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_)); | 6345 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_)); |
| 6340 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore)); | 6346 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore)); |
| 6341 } | 6347 } |
| OLD | NEW |