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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // HTML for the tests is all located in | 188 // HTML for the tests is all located in |
189 // test_root_directory/dir/<file> | 189 // test_root_directory/dir/<file> |
190 // The returned path is GURL format. | 190 // The returned path is GURL format. |
191 GURL GetTestUrl(const FilePath& dir, const FilePath& file); | 191 GURL GetTestUrl(const FilePath& dir, const FilePath& file); |
192 | 192 |
193 // Generate a URL for a file path including a query string. | 193 // Generate a URL for a file path including a query string. |
194 GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string); | 194 GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string); |
195 | 195 |
196 // Blocks until an application modal dialog is showns and returns it. | 196 // Blocks until an application modal dialog is showns and returns it. |
197 AppModalDialog* WaitForAppModalDialog(); | 197 AppModalDialog* WaitForAppModalDialog(); |
198 void WaitForAppModalDialogAndCloseIt(); | |
199 | 198 |
200 // Causes the specified tab to crash. Blocks until it is crashed. | 199 // Causes the specified tab to crash. Blocks until it is crashed. |
201 void CrashTab(content::WebContents* tab); | 200 void CrashTab(content::WebContents* tab); |
202 | 201 |
203 // Performs a find in the page of the specified tab. Returns the number of | 202 // Performs a find in the page of the specified tab. Returns the number of |
204 // matches found. |ordinal| is an optional parameter which is set to the index | 203 // matches found. |ordinal| is an optional parameter which is set to the index |
205 // of the current match. | 204 // of the current match. |
206 int FindInPage(TabContents* tab, | 205 int FindInPage(TabContents* tab, |
207 const string16& search_string, | 206 const string16& search_string, |
208 bool forward, | 207 bool forward, |
209 bool case_sensitive, | 208 bool case_sensitive, |
210 int* ordinal); | 209 int* ordinal); |
211 | 210 |
212 // Closes all infobars |tab| has open, if any. Tests that depend on there being | 211 // Closes all infobars |tab| has open, if any. Tests that depend on there being |
213 // no InfoBar open when the test starts may need to use this. | 212 // no InfoBar open when the test starts may need to use this. |
214 void CloseAllInfoBars(TabContents* tab); | 213 void CloseAllInfoBars(TabContents* tab); |
215 | 214 |
216 #if defined OS_MACOSX | |
217 void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds); | |
218 #endif | |
219 | |
220 // Returns true if the View is focused. | 215 // Returns true if the View is focused. |
221 bool IsViewFocused(const Browser* browser, ViewID vid); | 216 bool IsViewFocused(const Browser* browser, ViewID vid); |
222 | 217 |
223 // Simulates a mouse click on a View in the browser. | 218 // Simulates a mouse click on a View in the browser. |
224 void ClickOnView(const Browser* browser, ViewID vid); | 219 void ClickOnView(const Browser* browser, ViewID vid); |
225 | 220 |
226 // Register |observer| for the given |type| and |source| and run | 221 // Register |observer| for the given |type| and |source| and run |
227 // the message loop until the observer posts a quit task. | 222 // the message loop until the observer posts a quit task. |
228 void RegisterAndWait(content::NotificationObserver* observer, | 223 void RegisterAndWait(content::NotificationObserver* observer, |
229 int type, | 224 int type, |
230 const content::NotificationSource& source); | 225 const content::NotificationSource& source); |
231 | 226 |
232 // Blocks until |model| finishes loading. | 227 // Blocks until |model| finishes loading. |
233 void WaitForBookmarkModelToLoad(BookmarkModel* model); | 228 void WaitForBookmarkModelToLoad(BookmarkModel* model); |
234 | 229 |
235 // Blocks until |service| finishes loading. | 230 // Blocks until |service| finishes loading. |
236 void WaitForTemplateURLServiceToLoad(TemplateURLService* service); | 231 void WaitForTemplateURLServiceToLoad(TemplateURLService* service); |
237 | 232 |
238 // Blocks until the |history_service|'s history finishes loading. | 233 // Blocks until the |history_service|'s history finishes loading. |
239 void WaitForHistoryToLoad(HistoryService* history_service); | 234 void WaitForHistoryToLoad(HistoryService* history_service); |
240 | 235 |
241 // Puts the native window for |browser| in |native_window|. Returns true on | |
242 // success. | |
243 bool GetNativeWindow(const Browser* browser, gfx::NativeWindow* native_window); | |
244 | |
245 // Brings the native window for |browser| to the foreground. Returns true on | 236 // Brings the native window for |browser| to the foreground. Returns true on |
246 // success. | 237 // success. |
247 bool BringBrowserWindowToFront(const Browser* browser) WARN_UNUSED_RESULT; | 238 bool BringBrowserWindowToFront(const Browser* browser) WARN_UNUSED_RESULT; |
248 | 239 |
249 // Gets the first browser that is not in the specified set. | 240 // Gets the first browser that is not in the specified set. |
250 Browser* GetBrowserNotInSet(std::set<Browser*> excluded_browsers); | 241 Browser* GetBrowserNotInSet(std::set<Browser*> excluded_browsers); |
251 | 242 |
252 // Sends a key press, blocking until the key press is received or the test times | 243 // Sends a key press, blocking until the key press is received or the test times |
253 // out. This uses ui_controls::SendKeyPress, see it for details. Returns true | 244 // out. This uses ui_controls::SendKeyPress, see it for details. Returns true |
254 // if the event was successfully sent and received. | 245 // if the event was successfully sent and received. |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 // ui_controls_linux.cc and ui_controls_mac.cc | 559 // ui_controls_linux.cc and ui_controls_mac.cc |
569 void ClickTask(ui_controls::MouseButton button, | 560 void ClickTask(ui_controls::MouseButton button, |
570 int state, | 561 int state, |
571 const base::Closure& followup); | 562 const base::Closure& followup); |
572 | 563 |
573 } // namespace internal | 564 } // namespace internal |
574 | 565 |
575 } // namespace ui_test_utils | 566 } // namespace ui_test_utils |
576 | 567 |
577 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 568 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
OLD | NEW |