Chromium Code Reviews| 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__ |
|
jcampan
2008/09/10 23:01:24
Since you were changing the double __ to a single
| |
| 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_bar_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/template_url_model.h" | 15 #include "chrome/browser/template_url_model.h" |
| 16 #include "chrome/common/pref_service.h" | 16 #include "chrome/common/pref_service.h" |
| 17 | 17 |
| 18 class TestingProfile : public Profile { | 18 class TestingProfile : public Profile { |
| 19 public: | 19 public: |
| 20 TestingProfile(); | 20 TestingProfile(); |
| 21 virtual ~TestingProfile(); | 21 virtual ~TestingProfile(); |
| 22 | 22 |
| 23 // Creates the history service. If |delete_file| is true, the history file is | 23 // Creates the history service. If |delete_file| is true, the history file is |
| 24 // deleted first, then the HistoryService is created. As TestingProfile | 24 // deleted first, then the HistoryService is created. As TestingProfile |
| 25 // deletes the directory containing the files used by HistoryService, the | 25 // deletes the directory containing the files used by HistoryService, the |
| 26 // boolean only matters if you're recreating the HistoryService. | 26 // boolean only matters if you're recreating the HistoryService. |
| 27 void CreateHistoryService(bool delete_file); | 27 void CreateHistoryService(bool delete_file); |
| 28 | 28 |
| 29 // Creates the BookmkarBarModel. If not invoked the bookmark bar model is | 29 // Creates the BookmkarBarModel. If not invoked the bookmark bar model is |
| 30 // NULL. If |delete_file| is true, the bookmarks file is deleted first, then | 30 // NULL. If |delete_file| is true, the bookmarks file is deleted first, then |
| 31 // the model is created. As TestingProfile deletes the directory containing | 31 // the model is created. As TestingProfile deletes the directory containing |
| 32 // the files used by HistoryService, the boolean only matters if you're | 32 // the files used by HistoryService, the boolean only matters if you're |
| 33 // recreating the BookmarkBarModel. | 33 // recreating the BookmarkModel. |
| 34 // | 34 // |
| 35 // NOTE: this does not block until the bookmarks are loaded. For that use | 35 // NOTE: this does not block until the bookmarks are loaded. For that use |
| 36 // BlockUntilBookmarkModelLoaded. | 36 // BlockUntilBookmarkModelLoaded. |
| 37 void CreateBookmarkBarModel(bool delete_file); | 37 void CreateBookmarkModel(bool delete_file); |
| 38 | 38 |
| 39 // Blocks until the BookmarkBarModel finishes loaded. This is NOT invoked | 39 // Blocks until the BookmarkModel finishes loaded. This is NOT invoked from |
| 40 // from CreateBookmarkBarModel. | 40 // CreateBookmarkModel. |
| 41 void BlockUntilBookmarkModelLoaded(); | 41 void BlockUntilBookmarkModelLoaded(); |
| 42 | 42 |
| 43 // Creates a TemplateURLModel. If not invoked the TemplateURLModel is NULL. | 43 // Creates a TemplateURLModel. If not invoked the TemplateURLModel is NULL. |
| 44 void CreateTemplateURLModel(); | 44 void CreateTemplateURLModel(); |
| 45 | 45 |
| 46 virtual std::wstring GetPath() { | 46 virtual std::wstring GetPath() { |
| 47 return path_; | 47 return path_; |
| 48 } | 48 } |
| 49 virtual bool IsOffTheRecord() { | 49 virtual bool IsOffTheRecord() { |
| 50 return false; | 50 return false; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 virtual bool DidLastSessionExitCleanly() { | 123 virtual bool DidLastSessionExitCleanly() { |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 virtual void MergeResourceString(int message_id, | 126 virtual void MergeResourceString(int message_id, |
| 127 std::wstring* output_string) { | 127 std::wstring* output_string) { |
| 128 } | 128 } |
| 129 virtual void MergeResourceInteger(int message_id, int* output_value) { | 129 virtual void MergeResourceInteger(int message_id, int* output_value) { |
| 130 } | 130 } |
| 131 virtual void MergeResourceBoolean(int message_id, bool* output_value) { | 131 virtual void MergeResourceBoolean(int message_id, bool* output_value) { |
| 132 } | 132 } |
| 133 virtual bool HasBookmarkBarModel() { | 133 virtual BookmarkModel* GetBookmarkModel() { |
| 134 return (bookmark_bar_model_.get() != NULL); | |
| 135 } | |
| 136 virtual BookmarkBarModel* GetBookmarkBarModel() { | |
| 137 return bookmark_bar_model_.get(); | 134 return bookmark_bar_model_.get(); |
| 138 } | 135 } |
| 139 virtual bool Profile::IsSameProfile(Profile *p) { | 136 virtual bool Profile::IsSameProfile(Profile *p) { |
| 140 return this == p; | 137 return this == p; |
| 141 } | 138 } |
| 142 virtual Time GetStartTime() const { | 139 virtual Time GetStartTime() const { |
| 143 return start_time_; | 140 return start_time_; |
| 144 } | 141 } |
| 145 virtual TabRestoreService* GetTabRestoreService() { | 142 virtual TabRestoreService* GetTabRestoreService() { |
| 146 return NULL; | 143 return NULL; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 167 scoped_ptr<PrefService> prefs_; | 164 scoped_ptr<PrefService> prefs_; |
| 168 | 165 |
| 169 private: | 166 private: |
| 170 // If the history service has been created, it is destroyed. This is invoked | 167 // If the history service has been created, it is destroyed. This is invoked |
| 171 // from the destructor. | 168 // from the destructor. |
| 172 void DestroyHistoryService(); | 169 void DestroyHistoryService(); |
| 173 | 170 |
| 174 // The history service. Only created if CreateHistoryService is invoked. | 171 // The history service. Only created if CreateHistoryService is invoked. |
| 175 scoped_refptr<HistoryService> history_service_; | 172 scoped_refptr<HistoryService> history_service_; |
| 176 | 173 |
| 177 // The BookmarkBarModel. Only created if CreateBookmarkBarModel is invoked. | 174 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. |
| 178 scoped_ptr<BookmarkBarModel> bookmark_bar_model_; | 175 scoped_ptr<BookmarkModel> bookmark_bar_model_; |
| 179 | 176 |
| 180 // The TemplateURLFetcher. Only created if CreateTemplateURLModel is invoked. | 177 // The TemplateURLFetcher. Only created if CreateTemplateURLModel is invoked. |
| 181 scoped_ptr<TemplateURLModel> template_url_model_; | 178 scoped_ptr<TemplateURLModel> template_url_model_; |
| 182 | 179 |
| 183 // Do we have a history service? This defaults to the value of | 180 // Do we have a history service? This defaults to the value of |
| 184 // history_service, but can be explicitly set. | 181 // history_service, but can be explicitly set. |
| 185 bool has_history_service_; | 182 bool has_history_service_; |
| 186 }; | 183 }; |
| 187 | 184 |
| 188 #endif // CHROME_TEST_TESTING_PROFILE_H__ | 185 #endif // CHROME_TEST_TESTING_PROFILE_H__ |
| OLD | NEW |