| 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 <string> |
| 9 |
| 8 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| 9 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/test/base/scoped_testing_local_state.h" | 14 #include "chrome/test/base/scoped_testing_local_state.h" |
| 13 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
| 14 #include "content/public/test/test_utils.h" | 16 #include "content/public/test/test_utils.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 18 |
| 17 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 84 |
| 83 // Initialize an ExtensionService with a few already-installed extensions. | 85 // Initialize an ExtensionService with a few already-installed extensions. |
| 84 void InitializeGoodInstalledExtensionService(); | 86 void InitializeGoodInstalledExtensionService(); |
| 85 | 87 |
| 86 // Initialize an ExtensionService with autoupdate enabled. | 88 // Initialize an ExtensionService with autoupdate enabled. |
| 87 void InitializeExtensionServiceWithUpdater(); | 89 void InitializeExtensionServiceWithUpdater(); |
| 88 | 90 |
| 89 // Resets the browser thread bundle to one with |options|. | 91 // Resets the browser thread bundle to one with |options|. |
| 90 void ResetThreadBundle(int options); | 92 void ResetThreadBundle(int options); |
| 91 | 93 |
| 94 // Helpers to check the existence and values of extension prefs. |
| 95 size_t GetPrefKeyCount(); |
| 96 void ValidatePrefKeyCount(size_t count); |
| 97 testing::AssertionResult ValidateBooleanPref( |
| 98 const std::string& extension_id, |
| 99 const std::string& pref_path, |
| 100 bool expected_val); |
| 101 void ValidateIntegerPref(const std::string& extension_id, |
| 102 const std::string& pref_path, |
| 103 int expected_val); |
| 104 void ValidateStringPref(const std::string& extension_id, |
| 105 const std::string& pref_path, |
| 106 const std::string& expected_val); |
| 107 |
| 92 // TODO(rdevlin.cronin): Pull out more methods from ExtensionServiceTest that | 108 // TODO(rdevlin.cronin): Pull out more methods from ExtensionServiceTest that |
| 93 // are commonly used and/or reimplemented. For instance, methods to install | 109 // are commonly used and/or reimplemented. For instance, methods to install |
| 94 // extensions from various locations, etc. | 110 // extensions from various locations, etc. |
| 95 | 111 |
| 96 content::BrowserContext* browser_context(); | 112 content::BrowserContext* browser_context(); |
| 97 Profile* profile(); | 113 Profile* profile(); |
| 98 ExtensionService* service() { return service_; } | 114 ExtensionService* service() { return service_; } |
| 99 ExtensionRegistry* registry() { return registry_; } | 115 ExtensionRegistry* registry() { return registry_; } |
| 100 const base::FilePath& extensions_install_dir() const { | 116 const base::FilePath& extensions_install_dir() const { |
| 101 return extensions_install_dir_; | 117 return extensions_install_dir_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 #if defined OS_CHROMEOS | 162 #if defined OS_CHROMEOS |
| 147 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 163 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 148 chromeos::ScopedTestCrosSettings test_cros_settings_; | 164 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| 149 chromeos::ScopedTestUserManager test_user_manager_; | 165 chromeos::ScopedTestUserManager test_user_manager_; |
| 150 #endif | 166 #endif |
| 151 }; | 167 }; |
| 152 | 168 |
| 153 } // namespace extensions | 169 } // namespace extensions |
| 154 | 170 |
| 155 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ | 171 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ |
| OLD | NEW |