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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 78 |
79 BROWSER_TEST_MASK = BROWSER_TEST_WAIT_FOR_BROWSER | | 79 BROWSER_TEST_MASK = BROWSER_TEST_WAIT_FOR_BROWSER | |
80 BROWSER_TEST_WAIT_FOR_TAB | | 80 BROWSER_TEST_WAIT_FOR_TAB | |
81 BROWSER_TEST_WAIT_FOR_NAVIGATION | 81 BROWSER_TEST_WAIT_FOR_NAVIGATION |
82 }; | 82 }; |
83 | 83 |
84 // Turns on nestable tasks, runs all pending tasks in the message loop, | |
85 // then resets nestable tasks to what they were originally. Prefer this | |
86 // over MessageLoop::RunAllPending for in process browser tests to run | |
87 // all pending tasks. | |
88 void RunAllPendingInMessageLoop(); | |
89 | |
90 // Blocks the current thread until all the pending messages in the loop of the | |
91 // thread |thread_id| have been processed. | |
92 void RunAllPendingInMessageLoop(content::BrowserThread::ID thread_id); | |
93 | |
94 // Puts the current tab title in |title|. Returns true on success. | 84 // Puts the current tab title in |title|. Returns true on success. |
95 bool GetCurrentTabTitle(const Browser* browser, string16* title); | 85 bool GetCurrentTabTitle(const Browser* browser, string16* title); |
96 | 86 |
97 // Waits for a new tab to be added to |browser|. TODO(gbillock): remove this | 87 // Waits for a new tab to be added to |browser|. TODO(gbillock): remove this |
98 // race hazard. Use WindowedNotificationObserver instead. | 88 // race hazard. Use WindowedNotificationObserver instead. |
99 void WaitForNewTab(Browser* browser); | 89 void WaitForNewTab(Browser* browser); |
100 | 90 |
101 // Opens |url| in an incognito browser window with the incognito profile of | 91 // Opens |url| in an incognito browser window with the incognito profile of |
102 // |profile|, blocking until the navigation finishes. This will create a new | 92 // |profile|, blocking until the navigation finishes. This will create a new |
103 // browser if a browser with the incognito profile does not exist. Returns the | 93 // browser if a browser with the incognito profile does not exist. Returns the |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 // ui_controls_linux.cc and ui_controls_mac.cc | 429 // ui_controls_linux.cc and ui_controls_mac.cc |
440 void ClickTask(ui_controls::MouseButton button, | 430 void ClickTask(ui_controls::MouseButton button, |
441 int state, | 431 int state, |
442 const base::Closure& followup); | 432 const base::Closure& followup); |
443 | 433 |
444 } // namespace internal | 434 } // namespace internal |
445 | 435 |
446 } // namespace ui_test_utils | 436 } // namespace ui_test_utils |
447 | 437 |
448 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 438 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
OLD | NEW |