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_TEST_BASE_TESTING_PROFILE_H_ | 5 #ifndef CHROME_TEST_BASE_TESTING_PROFILE_H_ |
6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_ | 6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "components/domain_reliability/clear_mode.h" | 14 #include "components/domain_reliability/clear_mode.h" |
15 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" | 15 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" |
16 #include "components/keyed_service/core/refcounted_keyed_service.h" | |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 class MockResourceContext; | 19 class MockResourceContext; |
19 class SSLHostStateDelegate; | 20 class SSLHostStateDelegate; |
20 class ZoomLevelDelegate; | 21 class ZoomLevelDelegate; |
21 } | 22 } |
22 | 23 |
23 namespace history { | 24 namespace history { |
24 class TopSites; | 25 class TopSites; |
25 } | 26 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 // deleted first, then the HistoryService is created. As TestingProfile | 172 // deleted first, then the HistoryService is created. As TestingProfile |
172 // deletes the directory containing the files used by HistoryService, this | 173 // deletes the directory containing the files used by HistoryService, this |
173 // only matters if you're recreating the HistoryService. If |no_db| is true, | 174 // only matters if you're recreating the HistoryService. If |no_db| is true, |
174 // the history backend will fail to initialize its database; this is useful | 175 // the history backend will fail to initialize its database; this is useful |
175 // for testing error conditions. Returns true on success. | 176 // for testing error conditions. Returns true on success. |
176 bool CreateHistoryService(bool delete_file, bool no_db) WARN_UNUSED_RESULT; | 177 bool CreateHistoryService(bool delete_file, bool no_db) WARN_UNUSED_RESULT; |
177 | 178 |
178 // Shuts down and nulls out the reference to HistoryService. | 179 // Shuts down and nulls out the reference to HistoryService. |
179 void DestroyHistoryService(); | 180 void DestroyHistoryService(); |
180 | 181 |
181 // Creates TopSites. This returns immediately, and top sites may not be | |
182 // loaded. Use BlockUntilTopSitesLoaded to ensure TopSites has finished | |
183 // loading. | |
184 void CreateTopSites(); | |
185 | |
186 // Allows to set a test implementation |top_sites|. Testing profile owns | |
187 // the reference and is responsible for releasing memory. | |
188 void SetTopSites(history::TopSites* top_sites); | |
189 | |
190 // Shuts down and nulls out the reference to TopSites. | |
191 void DestroyTopSites(); | |
192 | |
193 // Creates the BookmarkBarModel. If not invoked the bookmark bar model is | 182 // Creates the BookmarkBarModel. If not invoked the bookmark bar model is |
194 // NULL. If |delete_file| is true, the bookmarks file is deleted first, then | 183 // NULL. If |delete_file| is true, the bookmarks file is deleted first, then |
195 // the model is created. As TestingProfile deletes the directory containing | 184 // the model is created. As TestingProfile deletes the directory containing |
196 // the files used by HistoryService, the boolean only matters if you're | 185 // the files used by HistoryService, the boolean only matters if you're |
197 // recreating the BookmarkModel. | 186 // recreating the BookmarkModel. |
198 // | 187 // |
199 // NOTE: this does not block until the bookmarks are loaded. For that use | 188 // NOTE: this does not block until the bookmarks are loaded. For that use |
200 // WaitForBookmarkModelToLoad(). | 189 // WaitForBookmarkModelToLoad(). |
201 void CreateBookmarkModel(bool delete_file); | 190 void CreateBookmarkModel(bool delete_file); |
202 | 191 |
192 void CreateTopSitesService(); | |
sdefresne
2015/01/08 10:41:02
nit: leave this method named CreateTopSites() and
Jitu( very slow this week)
2015/01/12 11:30:09
Done.
| |
193 | |
203 // Creates a WebDataService. If not invoked, the web data service is NULL. | 194 // Creates a WebDataService. If not invoked, the web data service is NULL. |
204 void CreateWebDataService(); | 195 void CreateWebDataService(); |
205 | 196 |
206 // Blocks until the HistoryService finishes restoring its in-memory cache. | 197 // Blocks until the HistoryService finishes restoring its in-memory cache. |
207 // This is NOT invoked from CreateHistoryService. | 198 // This is NOT invoked from CreateHistoryService. |
208 void BlockUntilHistoryIndexIsRefreshed(); | 199 void BlockUntilHistoryIndexIsRefreshed(); |
209 | 200 |
210 // Blocks until TopSites finishes loading. | 201 // Blocks until TopSites finishes loading. |
211 void BlockUntilTopSitesLoaded(); | 202 void BlockUntilTopSitesLoaded(); |
212 | 203 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 ExtensionSpecialStoragePolicy* extension_special_storage_policy); | 265 ExtensionSpecialStoragePolicy* extension_special_storage_policy); |
275 #endif | 266 #endif |
276 ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override; | 267 ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override; |
277 // TODO(ajwong): Remove this API in favor of directly retrieving the | 268 // TODO(ajwong): Remove this API in favor of directly retrieving the |
278 // CookieStore from the StoragePartition after ExtensionURLRequestContext | 269 // CookieStore from the StoragePartition after ExtensionURLRequestContext |
279 // has been removed. | 270 // has been removed. |
280 net::CookieMonster* GetCookieMonster(); | 271 net::CookieMonster* GetCookieMonster(); |
281 | 272 |
282 PrefService* GetPrefs() override; | 273 PrefService* GetPrefs() override; |
283 | 274 |
284 history::TopSites* GetTopSites() override; | |
285 history::TopSites* GetTopSitesWithoutCreating() override; | |
286 | |
287 net::URLRequestContextGetter* GetMediaRequestContext() override; | 275 net::URLRequestContextGetter* GetMediaRequestContext() override; |
288 net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 276 net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
289 int renderer_child_id) override; | 277 int renderer_child_id) override; |
290 net::URLRequestContextGetter* GetRequestContextForExtensions() override; | 278 net::URLRequestContextGetter* GetRequestContextForExtensions() override; |
291 net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( | 279 net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( |
292 const base::FilePath& partition_path, | 280 const base::FilePath& partition_path, |
293 bool in_memory) override; | 281 bool in_memory) override; |
294 net::URLRequestContextGetter* CreateRequestContextForStoragePartition( | 282 net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
295 const base::FilePath& partition_path, | 283 const base::FilePath& partition_path, |
296 bool in_memory, | 284 bool in_memory, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 bool guest_session_; | 364 bool guest_session_; |
377 | 365 |
378 std::string supervised_user_id_; | 366 std::string supervised_user_id_; |
379 | 367 |
380 // Did the last session exit cleanly? Default is true. | 368 // Did the last session exit cleanly? Default is true. |
381 bool last_session_exited_cleanly_; | 369 bool last_session_exited_cleanly_; |
382 | 370 |
383 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 371 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
384 | 372 |
385 base::FilePath last_selected_directory_; | 373 base::FilePath last_selected_directory_; |
386 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails. | |
387 | 374 |
388 #if defined(ENABLE_EXTENSIONS) | 375 #if defined(ENABLE_EXTENSIONS) |
389 scoped_refptr<ExtensionSpecialStoragePolicy> | 376 scoped_refptr<ExtensionSpecialStoragePolicy> |
390 extension_special_storage_policy_; | 377 extension_special_storage_policy_; |
391 #endif | 378 #endif |
392 | 379 |
393 // The proxy prefs tracker. | 380 // The proxy prefs tracker. |
394 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 381 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
395 | 382 |
396 // We use a temporary directory to store testing profile data. In a multi- | 383 // We use a temporary directory to store testing profile data. In a multi- |
(...skipping 20 matching lines...) Expand all Loading... | |
417 | 404 |
418 // Weak pointer to a delegate for indicating that a profile was created. | 405 // Weak pointer to a delegate for indicating that a profile was created. |
419 Delegate* delegate_; | 406 Delegate* delegate_; |
420 | 407 |
421 std::string profile_name_; | 408 std::string profile_name_; |
422 | 409 |
423 scoped_ptr<policy::PolicyService> policy_service_; | 410 scoped_ptr<policy::PolicyService> policy_service_; |
424 }; | 411 }; |
425 | 412 |
426 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ | 413 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ |
OLD | NEW |