OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_UI_TEST_H_ | 5 #ifndef CHROME_TEST_UI_UI_TEST_H_ |
6 #define CHROME_TEST_UI_UI_TEST_H_ | 6 #define CHROME_TEST_UI_UI_TEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // This file provides a common base for running UI unit tests, which operate | 9 // This file provides a common base for running UI unit tests, which operate |
10 // the entire browser application in a separate process for holistic | 10 // the entire browser application in a separate process for holistic |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 int GetActiveTabIndex() { return GetActiveTabIndex(0); } | 132 int GetActiveTabIndex() { return GetActiveTabIndex(0); } |
133 | 133 |
134 // Like above, but looks at the window at the given index. | 134 // Like above, but looks at the window at the given index. |
135 int GetActiveTabIndex(int window_index); | 135 int GetActiveTabIndex(int window_index); |
136 | 136 |
137 // Returns true when the browser process is running, independent if any | 137 // Returns true when the browser process is running, independent if any |
138 // renderer process exists or not. It will returns false if an user closed the | 138 // renderer process exists or not. It will returns false if an user closed the |
139 // window or if the browser process died by itself. | 139 // window or if the browser process died by itself. |
140 bool IsBrowserRunning(); | 140 bool IsBrowserRunning(); |
141 | 141 |
142 // Returns true when timeout_ms milliseconds have elapsed. | |
143 // Returns false if the browser process died while waiting. | |
144 bool CrashAwareSleep(int timeout_ms); | |
145 | |
146 // Returns the number of tabs in the first window. If no windows exist, | 142 // Returns the number of tabs in the first window. If no windows exist, |
147 // causes a test failure and returns 0. | 143 // causes a test failure and returns 0. |
148 int GetTabCount(); | 144 int GetTabCount(); |
149 | 145 |
150 // Same as GetTabCount(), except with the window at the given index. | 146 // Same as GetTabCount(), except with the window at the given index. |
151 int GetTabCount(int window_index); | 147 int GetTabCount(int window_index); |
152 | 148 |
153 // Polls up to kWaitForActionMaxMsec ms to attain a specific tab count. Will | 149 // Polls up to kWaitForActionMaxMsec ms to attain a specific tab count. Will |
154 // assert that the tab count is valid at the end of the wait. | 150 // assert that the tab count is valid at the end of the wait. |
155 void WaitUntilTabCount(int tab_count); | 151 void WaitUntilTabCount(int tab_count); |
156 | 152 |
157 // Wait for the browser process to shut down on its own (i.e. as a result of | |
158 // some action that your test has taken). | |
159 bool WaitForBrowserProcessToQuit(int timeout); | |
160 | |
161 // Waits until the Bookmark bar has stopped animating and become fully visible | 153 // Waits until the Bookmark bar has stopped animating and become fully visible |
162 // (if |wait_for_open| is true) or fully hidden (if |wait_for_open| is false). | 154 // (if |wait_for_open| is true) or fully hidden (if |wait_for_open| is false). |
163 // This function can time out (in which case it returns false). | 155 // This function can time out (in which case it returns false). |
164 bool WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, | 156 bool WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, |
165 bool wait_for_open); | 157 bool wait_for_open); |
166 | 158 |
167 // Sends the request to close the browser without blocking. | 159 // Sends the request to close the browser without blocking. |
168 // This is so we can interact with dialogs opened on browser close, | 160 // This is so we can interact with dialogs opened on browser close, |
169 // e.g. the beforeunload confirm dialog. | 161 // e.g. the beforeunload confirm dialog. |
170 void CloseBrowserAsync(BrowserProxy* browser) const; | 162 void CloseBrowserAsync(BrowserProxy* browser) const; |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 #ifdef UNIT_TEST | 487 #ifdef UNIT_TEST |
496 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); | 488 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); |
497 | 489 |
498 template<typename T> | 490 template<typename T> |
499 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { | 491 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { |
500 return out << ptr.get(); | 492 return out << ptr.get(); |
501 } | 493 } |
502 #endif // UNIT_TEST | 494 #endif // UNIT_TEST |
503 | 495 |
504 #endif // CHROME_TEST_UI_UI_TEST_H_ | 496 #endif // CHROME_TEST_UI_UI_TEST_H_ |
OLD | NEW |