| 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 |
| 142 // Returns the number of tabs in the first window. If no windows exist, | 146 // Returns the number of tabs in the first window. If no windows exist, |
| 143 // causes a test failure and returns 0. | 147 // causes a test failure and returns 0. |
| 144 int GetTabCount(); | 148 int GetTabCount(); |
| 145 | 149 |
| 146 // Same as GetTabCount(), except with the window at the given index. | 150 // Same as GetTabCount(), except with the window at the given index. |
| 147 int GetTabCount(int window_index); | 151 int GetTabCount(int window_index); |
| 148 | 152 |
| 149 // Polls up to kWaitForActionMaxMsec ms to attain a specific tab count. Will | 153 // Polls up to kWaitForActionMaxMsec ms to attain a specific tab count. Will |
| 150 // assert that the tab count is valid at the end of the wait. | 154 // assert that the tab count is valid at the end of the wait. |
| 151 void WaitUntilTabCount(int tab_count); | 155 void WaitUntilTabCount(int tab_count); |
| 152 | 156 |
| 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 |
| 153 // Waits until the Bookmark bar has stopped animating and become fully visible | 161 // Waits until the Bookmark bar has stopped animating and become fully visible |
| 154 // (if |wait_for_open| is true) or fully hidden (if |wait_for_open| is false). | 162 // (if |wait_for_open| is true) or fully hidden (if |wait_for_open| is false). |
| 155 // This function can time out (in which case it returns false). | 163 // This function can time out (in which case it returns false). |
| 156 bool WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, | 164 bool WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, |
| 157 bool wait_for_open); | 165 bool wait_for_open); |
| 158 | 166 |
| 159 // Sends the request to close the browser without blocking. | 167 // Sends the request to close the browser without blocking. |
| 160 // This is so we can interact with dialogs opened on browser close, | 168 // This is so we can interact with dialogs opened on browser close, |
| 161 // e.g. the beforeunload confirm dialog. | 169 // e.g. the beforeunload confirm dialog. |
| 162 void CloseBrowserAsync(BrowserProxy* browser) const; | 170 void CloseBrowserAsync(BrowserProxy* browser) const; |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 #ifdef UNIT_TEST | 495 #ifdef UNIT_TEST |
| 488 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); | 496 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); |
| 489 | 497 |
| 490 template<typename T> | 498 template<typename T> |
| 491 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { | 499 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { |
| 492 return out << ptr.get(); | 500 return out << ptr.get(); |
| 493 } | 501 } |
| 494 #endif // UNIT_TEST | 502 #endif // UNIT_TEST |
| 495 | 503 |
| 496 #endif // CHROME_TEST_UI_UI_TEST_H_ | 504 #endif // CHROME_TEST_UI_UI_TEST_H_ |
| OLD | NEW |