Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2480)

Unified Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 14973007: Auto-install/uninstall shared module dependencies for extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/installed_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_service_unittest.cc
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 7d9aca1386191643f8b5d04fa2387ca2cda6c193..89f9a781bda484f7fb7ae12cfc55af2c5300ee88 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -1450,6 +1450,66 @@ TEST_F(ExtensionServiceTest, UpdateOnStartup) {
prefs->GetDelayedInstallInfo("bjafgdebaacbbbecmhlhpofkepfkgcpa"));
}
+// Test various cases for delayed install because of missing imports.
+TEST_F(ExtensionServiceTest, PendingImports) {
+ InitPluginService();
+
+ base::FilePath source_install_dir = data_dir_
+ .AppendASCII("pending_updates_with_imports")
+ .AppendASCII("Extensions");
+ base::FilePath pref_path = source_install_dir
+ .DirName()
+ .AppendASCII("Preferences");
+
+ InitializeInstalledExtensionService(pref_path, source_install_dir);
+
+ // Verify there are no pending extensions initially.
+ EXPECT_FALSE(service_->pending_extension_manager()->HasPendingExtensions());
+
+ service_->Init();
+ // Wait for GarbageCollectExtensions task to complete.
+ loop_.RunUntilIdle();
+
+ // These extensions are used by the extensions we test below, they must be
+ // installed.
+ EXPECT_TRUE(file_util::PathExists(extensions_install_dir_.AppendASCII(
+ "bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0")));
+ EXPECT_TRUE(file_util::PathExists(extensions_install_dir_.AppendASCII(
+ "hpiknbiabeeppbpihjehijgoemciehgk/2")));
+
+ // Each of these extensions should have been rejected because of dependencies
+ // that cannot be satisfied.
+ ExtensionPrefs* prefs = service_->extension_prefs();
+ EXPECT_FALSE(
+ prefs->GetDelayedInstallInfo("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
+ EXPECT_FALSE(
+ prefs->GetInstalledExtensionInfo("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
+ EXPECT_FALSE(
+ prefs->GetDelayedInstallInfo("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"));
+ EXPECT_FALSE(
+ prefs->GetInstalledExtensionInfo("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"));
+ EXPECT_FALSE(
+ prefs->GetDelayedInstallInfo("cccccccccccccccccccccccccccccccc"));
+ EXPECT_FALSE(
+ prefs->GetInstalledExtensionInfo("cccccccccccccccccccccccccccccccc"));
+
+ // Make sure the import started for the extension with a dependency.
+ EXPECT_TRUE(
+ prefs->GetDelayedInstallInfo("behllobkkfkfnphdnhnkndlbkcpglgmj"));
+ EXPECT_EQ(ExtensionPrefs::DELAY_REASON_WAIT_FOR_IMPORTS,
+ prefs->GetDelayedInstallReason("behllobkkfkfnphdnhnkndlbkcpglgmj"));
+
+ EXPECT_FALSE(file_util::PathExists(extensions_install_dir_.AppendASCII(
+ "behllobkkfkfnphdnhnkndlbkcpglgmj/1.0.0.0")));
+
+ EXPECT_TRUE(service_->pending_extension_manager()->HasPendingExtensions());
+ std::string pending_id("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+ EXPECT_TRUE(service_->pending_extension_manager()->IsIdPending(pending_id));
+ // Remove it because we are not testing the pending extension manager's
+ // ability to download and install extensions.
+ EXPECT_TRUE(service_->pending_extension_manager()->Remove(pending_id));
+}
+
// Test installing extensions. This test tries to install few extensions using
// crx files. If you need to change those crx files, feel free to repackage
// them, throw away the key used and change the id's above.
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/installed_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698