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

Unified Diff: chrome/browser/component_updater/test/supervised_user_whitelist_installer_unittest.cc

Issue 879993005: Add support for uninstalling components and use it in SupervisedUserWhitelistInstaller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: fix Created 5 years, 10 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
Index: chrome/browser/component_updater/test/supervised_user_whitelist_installer_unittest.cc
diff --git a/chrome/browser/component_updater/test/supervised_user_whitelist_installer_unittest.cc b/chrome/browser/component_updater/test/supervised_user_whitelist_installer_unittest.cc
index d633447debec54aa1dbc4895a0a1ef15a59b2b44..c568c04da6a35d7afdc1bec7e98dc2ac91efc82d 100644
--- a/chrome/browser/component_updater/test/supervised_user_whitelist_installer_unittest.cc
+++ b/chrome/browser/component_updater/test/supervised_user_whitelist_installer_unittest.cc
@@ -96,6 +96,22 @@ class MockComponentUpdateService : public ComponentUpdateService {
return kOk;
}
+ Status UnregisterComponent(const std::string& crx_id) override {
+ if (!component_) {
+ ADD_FAILURE();
+ return kError;
+ }
+
+ EXPECT_EQ(GetCrxComponentID(*component_), crx_id);
+ if (!component_->installer->Uninstall()) {
+ ADD_FAILURE();
+ return kError;
+ }
+
+ component_.reset();
+ return kOk;
+ }
+
OnDemandUpdater& GetOnDemandUpdater() override { return on_demand_updater_; }
void MaybeThrottle(const std::string& kCrxId,
@@ -241,16 +257,27 @@ TEST_F(SupervisedUserWhitelistInstallerTest, InstallNewWhitelist) {
EXPECT_EQ(kWhitelistContents, whitelist_contents);
}
-TEST_F(SupervisedUserWhitelistInstallerTest, RegisterExistingWhitelist) {
+TEST_F(SupervisedUserWhitelistInstallerTest,
+ RegisterAndUninstallExistingWhitelist) {
ASSERT_TRUE(base::CreateDirectory(whitelist_directory_));
ASSERT_NO_FATAL_FAILURE(PrepareWhitelistDirectory(whitelist_directory_));
- base::RunLoop run_loop;
- bool new_installation = false;
- LoadWhitelist(new_installation, run_loop.QuitClosure());
- run_loop.Run();
+ {
+ base::RunLoop run_loop;
+ bool new_installation = false;
+ LoadWhitelist(new_installation, run_loop.QuitClosure());
+ run_loop.Run();
+ }
ASSERT_NO_FATAL_FAILURE(CheckRegisteredComponent(kVersion));
+
+ {
+ base::RunLoop run_loop;
+ installer_->UninstallWhitelist(kCrxId);
+ run_loop.RunUntilIdle();
+ }
+ EXPECT_FALSE(component_update_service_.registered_component());
+ EXPECT_FALSE(base::DirectoryExists(whitelist_directory_));
}
} // namespace component_updater

Powered by Google App Engine
This is Rietveld 408576698