| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UNITTEST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 class ExtensionServiceTestBase : public testing::Test { | 31 class ExtensionServiceTestBase : public testing::Test { |
| 32 public: | 32 public: |
| 33 struct ExtensionServiceInitParams { | 33 struct ExtensionServiceInitParams { |
| 34 base::FilePath profile_path; | 34 base::FilePath profile_path; |
| 35 base::FilePath pref_file; | 35 base::FilePath pref_file; |
| 36 base::FilePath extensions_install_dir; | 36 base::FilePath extensions_install_dir; |
| 37 bool autoupdate_enabled; | 37 bool autoupdate_enabled; |
| 38 bool is_first_run; | 38 bool is_first_run; |
| 39 bool profile_is_managed; |
| 39 | 40 |
| 40 ExtensionServiceInitParams(); | 41 ExtensionServiceInitParams(); |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 ExtensionServiceTestBase(); | 44 ExtensionServiceTestBase(); |
| 44 virtual ~ExtensionServiceTestBase(); | 45 virtual ~ExtensionServiceTestBase(); |
| 45 | 46 |
| 46 void InitializeExtensionService(const ExtensionServiceInitParams& params); | 47 void InitializeExtensionService(const ExtensionServiceInitParams& params); |
| 47 | 48 |
| 48 void InitializeInstalledExtensionService( | 49 void InitializeInstalledExtensionService( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 60 static void SetUpTestCase(); | 61 static void SetUpTestCase(); |
| 61 | 62 |
| 62 virtual void SetUp() OVERRIDE; | 63 virtual void SetUp() OVERRIDE; |
| 63 virtual void TearDown() OVERRIDE; | 64 virtual void TearDown() OVERRIDE; |
| 64 | 65 |
| 65 void set_extensions_enabled(bool enabled) { | 66 void set_extensions_enabled(bool enabled) { |
| 66 service_->set_extensions_enabled(enabled); | 67 service_->set_extensions_enabled(enabled); |
| 67 } | 68 } |
| 68 | 69 |
| 69 protected: | 70 protected: |
| 70 void InitializeExtensionServiceHelper(bool autoupdate_enabled, | 71 ExtensionServiceInitParams CreateDefaultInitParams(); |
| 71 bool is_first_run); | |
| 72 | 72 |
| 73 // Destroying at_exit_manager_ will delete all LazyInstances, so it must come | 73 // Destroying at_exit_manager_ will delete all LazyInstances, so it must come |
| 74 // after thread_bundle_ in the destruction order. | 74 // after thread_bundle_ in the destruction order. |
| 75 base::ShadowingAtExitManager at_exit_manager_; | 75 base::ShadowingAtExitManager at_exit_manager_; |
| 76 content::TestBrowserThreadBundle thread_bundle_; | 76 content::TestBrowserThreadBundle thread_bundle_; |
| 77 base::ScopedTempDir temp_dir_; | 77 base::ScopedTempDir temp_dir_; |
| 78 scoped_ptr<TestingProfile> profile_; | 78 scoped_ptr<TestingProfile> profile_; |
| 79 base::FilePath extensions_install_dir_; | 79 base::FilePath extensions_install_dir_; |
| 80 base::FilePath data_dir_; | 80 base::FilePath data_dir_; |
| 81 // Managed by extensions::ExtensionSystemFactory. | 81 // Managed by extensions::ExtensionSystemFactory. |
| 82 ExtensionService* service_; | 82 ExtensionService* service_; |
| 83 extensions::ManagementPolicy* management_policy_; | 83 extensions::ManagementPolicy* management_policy_; |
| 84 size_t expected_extensions_count_; | 84 size_t expected_extensions_count_; |
| 85 | 85 |
| 86 #if defined OS_CHROMEOS | 86 #if defined OS_CHROMEOS |
| 87 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 87 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 88 chromeos::ScopedTestCrosSettings test_cros_settings_; | 88 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| 89 chromeos::ScopedTestUserManager test_user_manager_; | 89 chromeos::ScopedTestUserManager test_user_manager_; |
| 90 #endif | 90 #endif |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ | 93 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ |
| OLD | NEW |