| 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 // Initialize an ExtensionService with a few already-installed extensions. | 96 // Initialize an ExtensionService with a few already-installed extensions. |
| 97 void InitializeGoodInstalledExtensionService(); | 97 void InitializeGoodInstalledExtensionService(); |
| 98 | 98 |
| 99 // Initialize an ExtensionService with autoupdate enabled. | 99 // Initialize an ExtensionService with autoupdate enabled. |
| 100 void InitializeExtensionServiceWithUpdater(); | 100 void InitializeExtensionServiceWithUpdater(); |
| 101 | 101 |
| 102 // Initializes an ExtensionService without extensions enabled. | 102 // Initializes an ExtensionService without extensions enabled. |
| 103 void InitializeExtensionServiceWithExtensionsDisabled(); | 103 void InitializeExtensionServiceWithExtensionsDisabled(); |
| 104 | 104 |
| 105 // Resets the browser thread bundle to one with |options|. | |
| 106 void ResetThreadBundle(int options); | |
| 107 | |
| 108 // Helpers to check the existence and values of extension prefs. | 105 // Helpers to check the existence and values of extension prefs. |
| 109 size_t GetPrefKeyCount(); | 106 size_t GetPrefKeyCount(); |
| 110 void ValidatePrefKeyCount(size_t count); | 107 void ValidatePrefKeyCount(size_t count); |
| 111 testing::AssertionResult ValidateBooleanPref( | 108 testing::AssertionResult ValidateBooleanPref( |
| 112 const std::string& extension_id, | 109 const std::string& extension_id, |
| 113 const std::string& pref_path, | 110 const std::string& pref_path, |
| 114 bool expected_val); | 111 bool expected_val); |
| 115 void ValidateIntegerPref(const std::string& extension_id, | 112 void ValidateIntegerPref(const std::string& extension_id, |
| 116 const std::string& pref_path, | 113 const std::string& pref_path, |
| 117 int expected_val); | 114 int expected_val); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 std::unique_ptr<TestingProfile> profile_; | 154 std::unique_ptr<TestingProfile> profile_; |
| 158 | 155 |
| 159 // The ExtensionService, whose lifetime is managed by |profile|'s | 156 // The ExtensionService, whose lifetime is managed by |profile|'s |
| 160 // ExtensionSystem. | 157 // ExtensionSystem. |
| 161 ExtensionService* service_; | 158 ExtensionService* service_; |
| 162 ScopedTestingLocalState testing_local_state_; | 159 ScopedTestingLocalState testing_local_state_; |
| 163 | 160 |
| 164 private: | 161 private: |
| 165 void CreateExtensionService(const ExtensionServiceInitParams& params); | 162 void CreateExtensionService(const ExtensionServiceInitParams& params); |
| 166 | 163 |
| 167 // Whether or not the thread bundle was reset in the test. | |
| 168 bool did_reset_thread_bundle_; | |
| 169 | |
| 170 // The directory into which extensions are installed. | 164 // The directory into which extensions are installed. |
| 171 base::FilePath extensions_install_dir_; | 165 base::FilePath extensions_install_dir_; |
| 172 | 166 |
| 173 // chrome/test/data/extensions/ | 167 // chrome/test/data/extensions/ |
| 174 base::FilePath data_dir_; | 168 base::FilePath data_dir_; |
| 175 | 169 |
| 176 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; | 170 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; |
| 177 | 171 |
| 178 // The associated ExtensionRegistry, for convenience. | 172 // The associated ExtensionRegistry, for convenience. |
| 179 extensions::ExtensionRegistry* registry_; | 173 extensions::ExtensionRegistry* registry_; |
| 180 | 174 |
| 181 #if defined OS_CHROMEOS | 175 #if defined OS_CHROMEOS |
| 182 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 176 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 183 chromeos::ScopedTestCrosSettings test_cros_settings_; | 177 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| 184 chromeos::ScopedTestUserManager test_user_manager_; | 178 chromeos::ScopedTestUserManager test_user_manager_; |
| 185 #endif | 179 #endif |
| 186 | 180 |
| 187 DISALLOW_COPY_AND_ASSIGN(ExtensionServiceTestBase); | 181 DISALLOW_COPY_AND_ASSIGN(ExtensionServiceTestBase); |
| 188 }; | 182 }; |
| 189 | 183 |
| 190 } // namespace extensions | 184 } // namespace extensions |
| 191 | 185 |
| 192 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ | 186 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ |
| OLD | NEW |