OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.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/history/history.h" | 13 #include "chrome/browser/history/history.h" |
14 #include "chrome/browser/profile.h" | 14 #include "chrome/browser/profile.h" |
| 15 #include "chrome/browser/sessions/session_service.h" |
15 #include "chrome/browser/template_url_model.h" | 16 #include "chrome/browser/template_url_model.h" |
16 #include "chrome/common/pref_service.h" | 17 #include "chrome/common/pref_service.h" |
17 | 18 |
18 class TestingProfile : public Profile { | 19 class TestingProfile : public Profile { |
19 public: | 20 public: |
20 TestingProfile(); | 21 TestingProfile(); |
21 // Creates a new profile by adding |count| to the end of the path. Use this | 22 // Creates a new profile by adding |count| to the end of the path. Use this |
22 // when you need to have more than one TestingProfile running at the same | 23 // when you need to have more than one TestingProfile running at the same |
23 // time. | 24 // time. |
24 explicit TestingProfile(int count); | 25 explicit TestingProfile(int count); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 101 } |
101 virtual DownloadManager* GetDownloadManager() { | 102 virtual DownloadManager* GetDownloadManager() { |
102 return NULL; | 103 return NULL; |
103 } | 104 } |
104 virtual bool HasCreatedDownloadManager() const { | 105 virtual bool HasCreatedDownloadManager() const { |
105 return false; | 106 return false; |
106 } | 107 } |
107 virtual URLRequestContext* GetRequestContext() { | 108 virtual URLRequestContext* GetRequestContext() { |
108 return NULL; | 109 return NULL; |
109 } | 110 } |
| 111 void set_session_service(SessionService* session_service) { |
| 112 session_service_ = session_service; |
| 113 } |
110 virtual SessionService* GetSessionService() { | 114 virtual SessionService* GetSessionService() { |
111 return NULL; | 115 return session_service_.get(); |
112 } | 116 } |
113 virtual void ShutdownSessionService() { | 117 virtual void ShutdownSessionService() { |
114 } | 118 } |
115 virtual bool HasSessionService() const { | 119 virtual bool HasSessionService() const { |
116 return false; | 120 return (session_service_.get() != NULL); |
117 } | 121 } |
118 virtual std::wstring GetName() { | 122 virtual std::wstring GetName() { |
119 return std::wstring(); | 123 return std::wstring(); |
120 } | 124 } |
121 virtual void SetName(const std::wstring& name) { | 125 virtual void SetName(const std::wstring& name) { |
122 } | 126 } |
123 virtual std::wstring GetID() { | 127 virtual std::wstring GetID() { |
124 return id_; | 128 return id_; |
125 } | 129 } |
126 virtual void SetID(const std::wstring& id) { | 130 virtual void SetID(const std::wstring& id) { |
127 id_ = id; | 131 id_ = id; |
128 } | 132 } |
| 133 void set_last_session_exited_cleanly(bool value) { |
| 134 last_session_exited_cleanly_ = value; |
| 135 } |
129 virtual bool DidLastSessionExitCleanly() { | 136 virtual bool DidLastSessionExitCleanly() { |
130 return true; | 137 return last_session_exited_cleanly_; |
131 } | 138 } |
132 virtual void MergeResourceString(int message_id, | 139 virtual void MergeResourceString(int message_id, |
133 std::wstring* output_string) { | 140 std::wstring* output_string) { |
134 } | 141 } |
135 virtual void MergeResourceInteger(int message_id, int* output_value) { | 142 virtual void MergeResourceInteger(int message_id, int* output_value) { |
136 } | 143 } |
137 virtual void MergeResourceBoolean(int message_id, bool* output_value) { | 144 virtual void MergeResourceBoolean(int message_id, bool* output_value) { |
138 } | 145 } |
139 virtual BookmarkModel* GetBookmarkModel() { | 146 virtual BookmarkModel* GetBookmarkModel() { |
140 return bookmark_bar_model_.get(); | 147 return bookmark_bar_model_.get(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 185 |
179 // The history service. Only created if CreateHistoryService is invoked. | 186 // The history service. Only created if CreateHistoryService is invoked. |
180 scoped_refptr<HistoryService> history_service_; | 187 scoped_refptr<HistoryService> history_service_; |
181 | 188 |
182 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. | 189 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. |
183 scoped_ptr<BookmarkModel> bookmark_bar_model_; | 190 scoped_ptr<BookmarkModel> bookmark_bar_model_; |
184 | 191 |
185 // The TemplateURLFetcher. Only created if CreateTemplateURLModel is invoked. | 192 // The TemplateURLFetcher. Only created if CreateTemplateURLModel is invoked. |
186 scoped_ptr<TemplateURLModel> template_url_model_; | 193 scoped_ptr<TemplateURLModel> template_url_model_; |
187 | 194 |
| 195 // The SessionService. Defaults to NULL, but can be set using the setter. |
| 196 scoped_refptr<SessionService> session_service_; |
| 197 |
188 // Do we have a history service? This defaults to the value of | 198 // Do we have a history service? This defaults to the value of |
189 // history_service, but can be explicitly set. | 199 // history_service, but can be explicitly set. |
190 bool has_history_service_; | 200 bool has_history_service_; |
191 | 201 |
192 std::wstring id_; | 202 std::wstring id_; |
193 | 203 |
194 bool off_the_record_; | 204 bool off_the_record_; |
| 205 |
| 206 // Did the last session exit cleanly? Default is true. |
| 207 bool last_session_exited_cleanly_; |
195 }; | 208 }; |
196 | 209 |
197 #endif // CHROME_TEST_TESTING_PROFILE_H__ | 210 #endif // CHROME_TEST_TESTING_PROFILE_H__ |
OLD | NEW |