| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_UI_TEST_UTILS_H_ | 5 #ifndef CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| 6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 // Blocks until |model| finishes loading. | 163 // Blocks until |model| finishes loading. |
| 164 void WaitForBookmarkModelToLoad(BookmarkModel* model); | 164 void WaitForBookmarkModelToLoad(BookmarkModel* model); |
| 165 | 165 |
| 166 // Blocks until |service| finishes loading. | 166 // Blocks until |service| finishes loading. |
| 167 void WaitForTemplateURLServiceToLoad(TemplateURLService* service); | 167 void WaitForTemplateURLServiceToLoad(TemplateURLService* service); |
| 168 | 168 |
| 169 // Blocks until the |history_service|'s history finishes loading. | 169 // Blocks until the |history_service|'s history finishes loading. |
| 170 void WaitForHistoryToLoad(HistoryService* history_service); | 170 void WaitForHistoryToLoad(HistoryService* history_service); |
| 171 | 171 |
| 172 // Download the given file and waits for the download to complete. |
| 173 void DownloadURL(Browser* browser, const GURL& download_url); |
| 174 |
| 172 // Brings the native window for |browser| to the foreground. Returns true on | 175 // Brings the native window for |browser| to the foreground. Returns true on |
| 173 // success. | 176 // success. |
| 174 bool BringBrowserWindowToFront(const Browser* browser) WARN_UNUSED_RESULT; | 177 bool BringBrowserWindowToFront(const Browser* browser) WARN_UNUSED_RESULT; |
| 175 | 178 |
| 176 // Gets the first browser that is not in the specified set. | 179 // Gets the first browser that is not in the specified set. |
| 177 Browser* GetBrowserNotInSet(std::set<Browser*> excluded_browsers); | 180 Browser* GetBrowserNotInSet(std::set<Browser*> excluded_browsers); |
| 178 | 181 |
| 179 // Sends a key press, blocking until the key press is received or the test times | 182 // Sends a key press, blocking until the key press is received or the test times |
| 180 // out. This uses ui_controls::SendKeyPress, see it for details. Returns true | 183 // out. This uses ui_controls::SendKeyPress, see it for details. Returns true |
| 181 // if the event was successfully sent and received. | 184 // if the event was successfully sent and received. |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 namespace internal { | 431 namespace internal { |
| 429 | 432 |
| 430 // A utility function to send a mouse click event in a closure. It's shared by | 433 // A utility function to send a mouse click event in a closure. It's shared by |
| 431 // ui_controls_linux.cc and ui_controls_mac.cc | 434 // ui_controls_linux.cc and ui_controls_mac.cc |
| 432 void ClickTask(ui_controls::MouseButton button, | 435 void ClickTask(ui_controls::MouseButton button, |
| 433 int state, | 436 int state, |
| 434 const base::Closure& followup); | 437 const base::Closure& followup); |
| 435 | 438 |
| 436 } // namespace internal | 439 } // namespace internal |
| 437 | 440 |
| 438 // Enumerates all history contents on the backend thread. | 441 // Enumerates all history contents on the backend thread. Returns them in |
| 439 class HistoryEnumerator : public HistoryService::URLEnumerator { | 442 // descending order by time. |
| 443 class HistoryEnumerator { |
| 440 public: | 444 public: |
| 441 explicit HistoryEnumerator(HistoryService* history); | 445 explicit HistoryEnumerator(Profile* profile); |
| 442 virtual ~HistoryEnumerator(); | 446 ~HistoryEnumerator(); |
| 443 | |
| 444 // HistoryService::URLEnumerator: | |
| 445 virtual void OnURL(const GURL& url) OVERRIDE; | |
| 446 virtual void OnComplete(bool success) OVERRIDE; | |
| 447 | 447 |
| 448 std::vector<GURL>& urls() { return urls_; } | 448 std::vector<GURL>& urls() { return urls_; } |
| 449 | 449 |
| 450 private: | 450 private: |
| 451 void HistoryQueryComplete( |
| 452 const base::Closure& quit_task, |
| 453 HistoryService::Handle request_handle, |
| 454 history::QueryResults* results); |
| 455 |
| 451 std::vector<GURL> urls_; | 456 std::vector<GURL> urls_; |
| 452 | 457 |
| 458 CancelableRequestConsumer consumer_; |
| 459 |
| 453 DISALLOW_COPY_AND_ASSIGN(HistoryEnumerator); | 460 DISALLOW_COPY_AND_ASSIGN(HistoryEnumerator); |
| 454 }; | 461 }; |
| 455 | 462 |
| 456 } // namespace ui_test_utils | 463 } // namespace ui_test_utils |
| 457 | 464 |
| 458 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 465 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| OLD | NEW |