Commit 7b19341c authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions Cleanup] Remove state parameter from test UninstallExtension

Remove the Extension::State parameter in
ExtensionServiceTestWithInstall::UninstallExtension. The burden of
verifying the extension's state prior to uninstallation should be part
of the calling tests, rather than part of the UninstallExtension method,
in order to reduce complexity and improve predictability.

Bug: 794205

Change-Id: Ia00758b58e20786d43799ea33a2dd72cfa42c565
Reviewed-on: https://chromium-review.googlesource.com/823011Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523999}
parent f91a759b
......@@ -1305,10 +1305,13 @@ TEST_F(ExtensionServiceSyncTest, ProcessSyncDataNewExtension) {
prefs->GetGrantedPermissions(good_crx);
EXPECT_EQ(test_case.expect_permissions_granted, !permissions->IsEmpty());
ASSERT_FALSE(service()->pending_extension_manager()->IsIdPending(good_crx));
if (test_case.sync_enabled)
EXPECT_TRUE(registry()->enabled_extensions().GetByID(good_crx));
else
EXPECT_TRUE(registry()->disabled_extensions().GetByID(good_crx));
// Remove the extension again, so we can install it again for the next case.
UninstallExtension(good_crx, test_case.sync_enabled ? Extension::ENABLED
: Extension::DISABLED);
UninstallExtension(good_crx);
}
}
......@@ -1567,8 +1570,7 @@ TEST_F(ExtensionServiceSyncTest, ProcessSyncDataEnableDisable) {
EXPECT_EQ(test_case.expect_disable_reasons, prefs->GetDisableReasons(id));
// Remove the extension again, so we can install it again for the next case.
UninstallExtension(
id, expect_enabled ? Extension::ENABLED : Extension::DISABLED);
UninstallExtension(id);
}
}
......@@ -1745,8 +1747,7 @@ TEST_F(ExtensionServiceSyncCustomGalleryTest,
}
// Remove the extension again, so we can install it again for the next case.
UninstallExtension(
id, expect_enabled ? Extension::ENABLED : Extension::DISABLED);
UninstallExtension(id);
}
}
......
......@@ -322,18 +322,12 @@ void ExtensionServiceTestWithInstall::UpdateExtension(
void ExtensionServiceTestWithInstall::UninstallExtension(
const std::string& id) {
UninstallExtension(id, Extension::ENABLED);
}
void ExtensionServiceTestWithInstall::UninstallExtension(
const std::string& id,
Extension::State expected_state) {
// Verify that the extension is installed.
ASSERT_TRUE(registry()->GetExtensionById(id, ExtensionRegistry::EVERYTHING));
base::FilePath extension_path = extensions_install_dir().AppendASCII(id);
EXPECT_TRUE(base::PathExists(extension_path));
size_t pref_key_count = GetPrefKeyCount();
EXPECT_GT(pref_key_count, 0u);
ValidateIntegerPref(id, "state", expected_state);
// We make a copy of the extension's id since the extension can be deleted
// once it's uninstalled.
......
......@@ -113,8 +113,6 @@ class ExtensionServiceTestWithInstall : public ExtensionServiceTestBase,
UpdateState expected_state);
void UninstallExtension(const std::string& id);
void UninstallExtension(const std::string& id,
Extension::State expected_state);
void TerminateExtension(const std::string& id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment