OLD | NEW |
1 // Copyright (c) 2009-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009-2010 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_TESTING_PROFILE_H_ | 5 #ifndef CHROME_TEST_TESTING_PROFILE_H_ |
6 #define CHROME_TEST_TESTING_PROFILE_H_ | 6 #define CHROME_TEST_TESTING_PROFILE_H_ |
7 | 7 |
8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
12 #include "chrome/browser/browser_prefs.h" | 12 #include "chrome/browser/browser_prefs.h" |
13 #include "chrome/browser/browser_theme_provider.h" | 13 #include "chrome/browser/browser_theme_provider.h" |
14 #include "chrome/browser/favicon_service.h" | 14 #include "chrome/browser/favicon_service.h" |
15 #include "chrome/browser/history/history.h" | 15 #include "chrome/browser/history/history.h" |
| 16 #include "chrome/browser/in_process_webkit/webkit_context.h" |
16 #include "chrome/browser/net/url_request_context_getter.h" | 17 #include "chrome/browser/net/url_request_context_getter.h" |
17 #include "chrome/browser/profile.h" | 18 #include "chrome/browser/profile.h" |
18 #include "chrome/browser/search_engines/template_url_model.h" | 19 #include "chrome/browser/search_engines/template_url_model.h" |
19 #include "chrome/browser/sessions/session_service.h" | 20 #include "chrome/browser/sessions/session_service.h" |
20 #include "chrome/common/pref_service.h" | 21 #include "chrome/common/pref_service.h" |
21 #include "net/base/cookie_monster.h" | 22 #include "net/base/cookie_monster.h" |
22 | 23 |
23 class TestingProfile : public Profile { | 24 class TestingProfile : public Profile { |
24 public: | 25 public: |
25 TestingProfile(); | 26 TestingProfile(); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 virtual void MergeResourceBoolean(int message_id, bool* output_value) {} | 194 virtual void MergeResourceBoolean(int message_id, bool* output_value) {} |
194 virtual BookmarkModel* GetBookmarkModel() { | 195 virtual BookmarkModel* GetBookmarkModel() { |
195 return bookmark_bar_model_.get(); | 196 return bookmark_bar_model_.get(); |
196 } | 197 } |
197 virtual bool IsSameProfile(Profile *p) { return this == p; } | 198 virtual bool IsSameProfile(Profile *p) { return this == p; } |
198 virtual base::Time GetStartTime() const { return start_time_; } | 199 virtual base::Time GetStartTime() const { return start_time_; } |
199 virtual TabRestoreService* GetTabRestoreService() { return NULL; } | 200 virtual TabRestoreService* GetTabRestoreService() { return NULL; } |
200 virtual void ResetTabRestoreService() {} | 201 virtual void ResetTabRestoreService() {} |
201 virtual SpellCheckHost* GetSpellCheckHost() { return NULL; } | 202 virtual SpellCheckHost* GetSpellCheckHost() { return NULL; } |
202 virtual void ReinitializeSpellCheckHost(bool force) { } | 203 virtual void ReinitializeSpellCheckHost(bool force) { } |
203 virtual WebKitContext* GetWebKitContext() { return NULL; } | 204 virtual WebKitContext* GetWebKitContext() { |
| 205 if (webkit_context_ == NULL) { |
| 206 webkit_context_ = new WebKitContext(GetPath(), false); |
| 207 } |
| 208 return webkit_context_; |
| 209 } |
204 virtual WebKitContext* GetOffTheRecordWebKitContext() { return NULL; } | 210 virtual WebKitContext* GetOffTheRecordWebKitContext() { return NULL; } |
205 virtual void MarkAsCleanShutdown() {} | 211 virtual void MarkAsCleanShutdown() {} |
206 virtual void InitExtensions() {} | 212 virtual void InitExtensions() {} |
207 virtual void InitWebResources() {} | 213 virtual void InitWebResources() {} |
208 virtual NTPResourceCache* GetNTPResourceCache(); | 214 virtual NTPResourceCache* GetNTPResourceCache(); |
209 virtual DesktopNotificationService* GetDesktopNotificationService() { | 215 virtual DesktopNotificationService* GetDesktopNotificationService() { |
210 return NULL; | 216 return NULL; |
211 } | 217 } |
212 | 218 |
213 // Schedules a task on the history backend and runs a nested loop until the | 219 // Schedules a task on the history backend and runs a nested loop until the |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 std::wstring id_; | 269 std::wstring id_; |
264 | 270 |
265 bool off_the_record_; | 271 bool off_the_record_; |
266 | 272 |
267 // Did the last session exit cleanly? Default is true. | 273 // Did the last session exit cleanly? Default is true. |
268 bool last_session_exited_cleanly_; | 274 bool last_session_exited_cleanly_; |
269 | 275 |
270 // The main database tracker for this profile. | 276 // The main database tracker for this profile. |
271 // Should be used only on the file thread. | 277 // Should be used only on the file thread. |
272 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; | 278 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; |
| 279 |
| 280 // WebKitContext, lazily initialized by GetWebKitContext(). |
| 281 scoped_refptr<WebKitContext> webkit_context_; |
273 }; | 282 }; |
274 | 283 |
275 // A profile that derives from another profile. This does not actually | 284 // A profile that derives from another profile. This does not actually |
276 // override anything except the GetRuntimeId() in order to test sharing of | 285 // override anything except the GetRuntimeId() in order to test sharing of |
277 // site information. | 286 // site information. |
278 class DerivedTestingProfile : public TestingProfile { | 287 class DerivedTestingProfile : public TestingProfile { |
279 public: | 288 public: |
280 explicit DerivedTestingProfile(Profile* profile) | 289 explicit DerivedTestingProfile(Profile* profile) |
281 : original_profile_(profile) {} | 290 : original_profile_(profile) {} |
282 | 291 |
283 virtual ProfileId GetRuntimeId() { | 292 virtual ProfileId GetRuntimeId() { |
284 return original_profile_->GetRuntimeId(); | 293 return original_profile_->GetRuntimeId(); |
285 } | 294 } |
286 | 295 |
287 protected: | 296 protected: |
288 Profile* original_profile_; | 297 Profile* original_profile_; |
289 }; | 298 }; |
290 | 299 |
291 #endif // CHROME_TEST_TESTING_PROFILE_H_ | 300 #endif // CHROME_TEST_TESTING_PROFILE_H_ |
OLD | NEW |