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