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 <string> | 11 #include <string> |
11 | 12 |
12 #include "base/at_exit.h" | 13 #include "base/at_exit.h" |
13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
14 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "chrome/test/base/scoped_testing_local_state.h" | 18 #include "chrome/test/base/scoped_testing_local_state.h" |
19 #include "content/public/test/test_browser_thread_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.h" |
20 #include "content/public/test/test_utils.h" | 20 #include "content/public/test/test_utils.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
24 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 24 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
25 #include "chrome/browser/chromeos/settings/cros_settings.h" | 25 #include "chrome/browser/chromeos/settings/cros_settings.h" |
26 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 26 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 private: | 128 private: |
129 // Must be declared before anything that may make use of the | 129 // Must be declared before anything that may make use of the |
130 // directory so as to ensure files are closed before cleanup. | 130 // directory so as to ensure files are closed before cleanup. |
131 base::ScopedTempDir temp_dir_; | 131 base::ScopedTempDir temp_dir_; |
132 | 132 |
133 // Destroying at_exit_manager_ will delete all LazyInstances, so it must come | 133 // Destroying at_exit_manager_ will delete all LazyInstances, so it must come |
134 // after thread_bundle_ in the destruction order. | 134 // after thread_bundle_ in the destruction order. |
135 base::ShadowingAtExitManager at_exit_manager_; | 135 base::ShadowingAtExitManager at_exit_manager_; |
136 | 136 |
137 scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_; | 137 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; |
138 | 138 |
139 protected: | 139 protected: |
140 // It's unfortunate that these are exposed to subclasses (rather than used | 140 // It's unfortunate that these are exposed to subclasses (rather than used |
141 // through the accessor methods above), but too many tests already use them | 141 // through the accessor methods above), but too many tests already use them |
142 // directly. | 142 // directly. |
143 | 143 |
144 // The associated testing profile. | 144 // The associated testing profile. |
145 scoped_ptr<TestingProfile> profile_; | 145 std::unique_ptr<TestingProfile> profile_; |
146 | 146 |
147 // The ExtensionService, whose lifetime is managed by |profile|'s | 147 // The ExtensionService, whose lifetime is managed by |profile|'s |
148 // ExtensionSystem. | 148 // ExtensionSystem. |
149 ExtensionService* service_; | 149 ExtensionService* service_; |
150 ScopedTestingLocalState testing_local_state_; | 150 ScopedTestingLocalState testing_local_state_; |
151 | 151 |
152 private: | 152 private: |
153 void CreateExtensionService(const ExtensionServiceInitParams& params); | 153 void CreateExtensionService(const ExtensionServiceInitParams& params); |
154 | 154 |
155 // Whether or not the thread bundle was reset in the test. | 155 // Whether or not the thread bundle was reset in the test. |
(...skipping 15 matching lines...) Expand all Loading... |
171 chromeos::ScopedTestCrosSettings test_cros_settings_; | 171 chromeos::ScopedTestCrosSettings test_cros_settings_; |
172 chromeos::ScopedTestUserManager test_user_manager_; | 172 chromeos::ScopedTestUserManager test_user_manager_; |
173 #endif | 173 #endif |
174 | 174 |
175 DISALLOW_COPY_AND_ASSIGN(ExtensionServiceTestBase); | 175 DISALLOW_COPY_AND_ASSIGN(ExtensionServiceTestBase); |
176 }; | 176 }; |
177 | 177 |
178 } // namespace extensions | 178 } // namespace extensions |
179 | 179 |
180 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ | 180 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_TEST_BASE_H_ |
OLD | NEW |