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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // They can be ORed together. | 68 // They can be ORed together. |
69 // The order in which the waits happen when more than one is selected, is: | 69 // The order in which the waits happen when more than one is selected, is: |
70 // Browser | 70 // Browser |
71 // Tab | 71 // Tab |
72 // Navigation | 72 // Navigation |
73 enum BrowserTestWaitFlags { | 73 enum BrowserTestWaitFlags { |
74 BROWSER_TEST_NONE = 0, // Don't wait for anything. | 74 BROWSER_TEST_NONE = 0, // Don't wait for anything. |
75 BROWSER_TEST_WAIT_FOR_BROWSER = 1 << 0, // Wait for a new browser. | 75 BROWSER_TEST_WAIT_FOR_BROWSER = 1 << 0, // Wait for a new browser. |
76 BROWSER_TEST_WAIT_FOR_TAB = 1 << 1, // Wait for a new tab. | 76 BROWSER_TEST_WAIT_FOR_TAB = 1 << 1, // Wait for a new tab. |
77 BROWSER_TEST_WAIT_FOR_NAVIGATION = 1 << 2, // Wait for navigation to finish. | 77 BROWSER_TEST_WAIT_FOR_NAVIGATION = 1 << 2, // Wait for navigation to finish. |
78 BROWSER_TEST_WAIT_FOR_AUTH = 1 << 3, // Wait for auth prompt. | |
79 | 78 |
80 BROWSER_TEST_MASK = BROWSER_TEST_WAIT_FOR_BROWSER | | 79 BROWSER_TEST_MASK = BROWSER_TEST_WAIT_FOR_BROWSER | |
81 BROWSER_TEST_WAIT_FOR_TAB | | 80 BROWSER_TEST_WAIT_FOR_TAB | |
82 BROWSER_TEST_WAIT_FOR_NAVIGATION | 81 BROWSER_TEST_WAIT_FOR_NAVIGATION |
83 }; | 82 }; |
84 | 83 |
85 // Turns on nestable tasks, runs the message loop, then resets nestable tasks | 84 // Turns on nestable tasks, runs the message loop, then resets nestable tasks |
86 // to what they were originally. Prefer this over MessageLoop::Run for in | 85 // to what they were originally. Prefer this over MessageLoop::Run for in |
87 // process browser tests that need to block until a condition is met. | 86 // process browser tests that need to block until a condition is met. |
88 void RunMessageLoop(); | 87 void RunMessageLoop(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // test_root_directory/dir/<file> | 142 // test_root_directory/dir/<file> |
144 // The returned path is FilePath format. | 143 // The returned path is FilePath format. |
145 FilePath GetTestFilePath(const FilePath& dir, const FilePath& file); | 144 FilePath GetTestFilePath(const FilePath& dir, const FilePath& file); |
146 | 145 |
147 // Generate the URL for testing a particular test. | 146 // Generate the URL for testing a particular test. |
148 // HTML for the tests is all located in | 147 // HTML for the tests is all located in |
149 // test_root_directory/dir/<file> | 148 // test_root_directory/dir/<file> |
150 // The returned path is GURL format. | 149 // The returned path is GURL format. |
151 GURL GetTestUrl(const FilePath& dir, const FilePath& file); | 150 GURL GetTestUrl(const FilePath& dir, const FilePath& file); |
152 | 151 |
153 // Generate a URL for a file path including a query string. | |
154 GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string); | |
155 | |
156 // Blocks until an application modal dialog is showns and returns it. | 152 // Blocks until an application modal dialog is showns and returns it. |
157 AppModalDialog* WaitForAppModalDialog(); | 153 AppModalDialog* WaitForAppModalDialog(); |
158 | 154 |
159 // Causes the specified tab to crash. Blocks until it is crashed. | 155 // Causes the specified tab to crash. Blocks until it is crashed. |
160 void CrashTab(content::WebContents* tab); | 156 void CrashTab(content::WebContents* tab); |
161 | 157 |
162 // Performs a find in the page of the specified tab. Returns the number of | 158 // Performs a find in the page of the specified tab. Returns the number of |
163 // matches found. |ordinal| is an optional parameter which is set to the index | 159 // matches found. |ordinal| is an optional parameter which is set to the index |
164 // of the current match. | 160 // of the current match. |
165 int FindInPage(TabContents* tab, | 161 int FindInPage(TabContents* tab, |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // ui_controls_linux.cc and ui_controls_mac.cc | 451 // ui_controls_linux.cc and ui_controls_mac.cc |
456 void ClickTask(ui_controls::MouseButton button, | 452 void ClickTask(ui_controls::MouseButton button, |
457 int state, | 453 int state, |
458 const base::Closure& followup); | 454 const base::Closure& followup); |
459 | 455 |
460 } // namespace internal | 456 } // namespace internal |
461 | 457 |
462 } // namespace ui_test_utils | 458 } // namespace ui_test_utils |
463 | 459 |
464 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 460 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
OLD | NEW |