OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SEARCH_ENGINES_TEMPLATE_URL_MODEL_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_TEST_UTIL_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_TEST_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #include "base/string16.h" |
15 #include "chrome/browser/browser_thread.h" | 16 #include "chrome/browser/browser_thread.h" |
16 #include "chrome/browser/search_engines/template_url_model_observer.h" | 17 #include "chrome/browser/search_engines/template_url_model_observer.h" |
17 | 18 |
18 class TemplateURLModel; | 19 class TemplateURLModel; |
19 class TemplateURLModelTestingProfile; | 20 class TemplateURLModelTestingProfile; |
20 class TestingTemplateURLModel; | 21 class TestingTemplateURLModel; |
21 class TestingProfile; | 22 class TestingProfile; |
22 class WebDataService; | 23 class WebDataService; |
23 | 24 |
24 // Implements functionality to make it easier to test TemplateURLModel and | 25 // Implements functionality to make it easier to test TemplateURLModel and |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 void ChangeModelToLoadState(); | 64 void ChangeModelToLoadState(); |
64 | 65 |
65 // Deletes the current model (and doesn't create a new one). | 66 // Deletes the current model (and doesn't create a new one). |
66 void ClearModel(); | 67 void ClearModel(); |
67 | 68 |
68 // Creates a new TemplateURLModel. | 69 // Creates a new TemplateURLModel. |
69 void ResetModel(bool verify_load); | 70 void ResetModel(bool verify_load); |
70 | 71 |
71 // Returns the search term from the last invocation of | 72 // Returns the search term from the last invocation of |
72 // TemplateURLModel::SetKeywordSearchTermsForURL and clears the search term. | 73 // TemplateURLModel::SetKeywordSearchTermsForURL and clears the search term. |
73 std::wstring GetAndClearSearchTerm(); | 74 string16 GetAndClearSearchTerm(); |
74 | 75 |
75 // Set the google base url. | 76 // Set the google base url. |
76 void SetGoogleBaseURL(const std::string& base_url) const; | 77 void SetGoogleBaseURL(const std::string& base_url) const; |
77 | 78 |
78 // Returns the WebDataService. | 79 // Returns the WebDataService. |
79 WebDataService* GetWebDataService(); | 80 WebDataService* GetWebDataService(); |
80 | 81 |
81 // Returns the TemplateURLModel. | 82 // Returns the TemplateURLModel. |
82 TemplateURLModel* model() const; | 83 TemplateURLModel* model() const; |
83 | 84 |
84 // Returns the TestingProfile. | 85 // Returns the TestingProfile. |
85 TestingProfile* profile() const; | 86 TestingProfile* profile() const; |
86 | 87 |
87 // Starts an I/O thread. | 88 // Starts an I/O thread. |
88 void StartIOThread(); | 89 void StartIOThread(); |
89 | 90 |
90 private: | 91 private: |
91 MessageLoopForUI message_loop_; | 92 MessageLoopForUI message_loop_; |
92 // Needed to make the DeleteOnUIThread trait of WebDataService work | 93 // Needed to make the DeleteOnUIThread trait of WebDataService work |
93 // properly. | 94 // properly. |
94 BrowserThread ui_thread_; | 95 BrowserThread ui_thread_; |
95 scoped_ptr<TemplateURLModelTestingProfile> profile_; | 96 scoped_ptr<TemplateURLModelTestingProfile> profile_; |
96 scoped_ptr<TestingTemplateURLModel> model_; | 97 scoped_ptr<TestingTemplateURLModel> model_; |
97 int changed_count_; | 98 int changed_count_; |
98 | 99 |
99 DISALLOW_COPY_AND_ASSIGN(TemplateURLModelTestUtil); | 100 DISALLOW_COPY_AND_ASSIGN(TemplateURLModelTestUtil); |
100 }; | 101 }; |
101 | 102 |
102 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_TEST_UTIL_H_ | 103 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_TEST_UTIL_H_ |
OLD | NEW |