| 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 1f0ef1f584b39f8062eeb93b269ff5775f06389b..db6e5693c46defe9ed6239e5378d0c6bd39ef504 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
|
| @@ -58,10 +58,7 @@ class MockComponentUpdateService : public ComponentUpdateService {
|
| const scoped_refptr<base::SequencedTaskRunner>& task_runner)
|
| : task_runner_(task_runner) {}
|
|
|
| - ~MockComponentUpdateService() override {
|
| - if (component_)
|
| - delete component_->installer;
|
| - }
|
| + ~MockComponentUpdateService() override {}
|
|
|
| MockOnDemandUpdater& on_demand_updater() { return on_demand_updater_; }
|
|
|
| @@ -99,6 +96,17 @@ 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);
|
| + component_.reset();
|
| + return kOk;
|
| + }
|
| +
|
| OnDemandUpdater& GetOnDemandUpdater() override { return on_demand_updater_; }
|
|
|
| void MaybeThrottle(const std::string& kCrxId,
|
| @@ -244,16 +252,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
|
|
|