| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_garbage_collector_chromeos.h" | 5 #include "chrome/browser/extensions/extension_garbage_collector_chromeos.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 namespace extensions { | 40 namespace extensions { |
| 41 | 41 |
| 42 class ExtensionGarbageCollectorChromeOSUnitTest | 42 class ExtensionGarbageCollectorChromeOSUnitTest |
| 43 : public ExtensionServiceTestBase { | 43 : public ExtensionServiceTestBase { |
| 44 protected: | 44 protected: |
| 45 PrefService& local_state() { return local_state_; } | 45 PrefService& local_state() { return local_state_; } |
| 46 const base::FilePath& cache_dir() { return cache_dir_.path(); } | 46 const base::FilePath& cache_dir() { return cache_dir_.path(); } |
| 47 | 47 |
| 48 virtual void SetUp() OVERRIDE { | 48 virtual void SetUp() override { |
| 49 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); | 49 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); |
| 50 chrome::RegisterLocalState(local_state_.registry()); | 50 chrome::RegisterLocalState(local_state_.registry()); |
| 51 | 51 |
| 52 #if defined(ENABLE_PLUGINS) | 52 #if defined(ENABLE_PLUGINS) |
| 53 content::PluginService::GetInstance()->Init(); | 53 content::PluginService::GetInstance()->Init(); |
| 54 #endif | 54 #endif |
| 55 InitializeGoodInstalledExtensionService(); | 55 InitializeGoodInstalledExtensionService(); |
| 56 | 56 |
| 57 // Need real IO thread. | 57 // Need real IO thread. |
| 58 service_->SetFileTaskRunnerForTesting( | 58 service_->SetFileTaskRunnerForTesting( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 69 // Initialize the UserManager singleton to a fresh FakeUserManager instance. | 69 // Initialize the UserManager singleton to a fresh FakeUserManager instance. |
| 70 user_manager_enabler_.reset( | 70 user_manager_enabler_.reset( |
| 71 new chromeos::ScopedUserManagerEnabler(new chromeos::FakeUserManager)); | 71 new chromeos::ScopedUserManagerEnabler(new chromeos::FakeUserManager)); |
| 72 | 72 |
| 73 GetFakeUserManager()->AddUser(chromeos::login::kStubUser); | 73 GetFakeUserManager()->AddUser(chromeos::login::kStubUser); |
| 74 GetFakeUserManager()->LoginUser(chromeos::login::kStubUser); | 74 GetFakeUserManager()->LoginUser(chromeos::login::kStubUser); |
| 75 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting( | 75 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting( |
| 76 GetFakeUserManager()->GetActiveUser(), profile_.get()); | 76 GetFakeUserManager()->GetActiveUser(), profile_.get()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 virtual void TearDown() OVERRIDE { | 79 virtual void TearDown() override { |
| 80 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); | 80 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void GarbageCollectExtensions() { | 83 void GarbageCollectExtensions() { |
| 84 ExtensionGarbageCollector::Get(profile_.get()) | 84 ExtensionGarbageCollector::Get(profile_.get()) |
| 85 ->GarbageCollectExtensionsForTest(); | 85 ->GarbageCollectExtensionsForTest(); |
| 86 // Wait for GarbageCollectExtensions task to complete. | 86 // Wait for GarbageCollectExtensions task to complete. |
| 87 content::RunAllBlockingPoolTasksUntilIdle(); | 87 content::RunAllBlockingPoolTasksUntilIdle(); |
| 88 } | 88 } |
| 89 | 89 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 const base::DictionaryValue* shared_extensions = local_state().GetDictionary( | 197 const base::DictionaryValue* shared_extensions = local_state().GetDictionary( |
| 198 ExtensionAssetsManagerChromeOS::kSharedExtensions); | 198 ExtensionAssetsManagerChromeOS::kSharedExtensions); |
| 199 ASSERT_TRUE(shared_extensions); | 199 ASSERT_TRUE(shared_extensions); |
| 200 | 200 |
| 201 EXPECT_FALSE(shared_extensions->HasKey(kExtensionId1)); | 201 EXPECT_FALSE(shared_extensions->HasKey(kExtensionId1)); |
| 202 EXPECT_TRUE(shared_extensions->HasKey(kExtensionId2)); | 202 EXPECT_TRUE(shared_extensions->HasKey(kExtensionId2)); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace extensions | 205 } // namespace extensions |
| OLD | NEW |