OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_AUTOMATION_AUTOMATION_PROXY_H__ | 5 #ifndef CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ |
6 #define CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ | 6 #define CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 bool OpenNewBrowserWindow(bool show); | 87 bool OpenNewBrowserWindow(bool show); |
88 | 88 |
89 // Fills the number of open browser windows into the given variable, returning | 89 // Fills the number of open browser windows into the given variable, returning |
90 // true on success. False likely indicates an IPC error. | 90 // true on success. False likely indicates an IPC error. |
91 bool GetBrowserWindowCount(int* num_windows); | 91 bool GetBrowserWindowCount(int* num_windows); |
92 | 92 |
93 // Block the thread until the window count becomes the provided value. | 93 // Block the thread until the window count becomes the provided value. |
94 // Returns true on success. | 94 // Returns true on success. |
95 bool WaitForWindowCountToBecome(int target_count, int wait_timeout); | 95 bool WaitForWindowCountToBecome(int target_count, int wait_timeout); |
96 | 96 |
| 97 // Fills the number of open normal browser windows (normal type and |
| 98 // non-incognito mode) into the given variable, returning true on success. |
| 99 // False likely indicates an IPC error. |
| 100 bool GetNormalBrowserWindowCount(int* num_windows); |
| 101 |
97 // Returns whether an app modal dialog window is showing right now (i.e., a | 102 // Returns whether an app modal dialog window is showing right now (i.e., a |
98 // javascript alert), and what buttons it contains. | 103 // javascript alert), and what buttons it contains. |
99 bool GetShowingAppModalDialog(bool* showing_app_modal_dialog, | 104 bool GetShowingAppModalDialog(bool* showing_app_modal_dialog, |
100 MessageBoxFlags::DialogButton* button); | 105 MessageBoxFlags::DialogButton* button); |
101 | 106 |
102 // Simulates a click on a dialog button. | 107 // Simulates a click on a dialog button. |
103 bool ClickAppModalDialogButton(MessageBoxFlags::DialogButton button); | 108 bool ClickAppModalDialogButton(MessageBoxFlags::DialogButton button); |
104 | 109 |
105 // Block the thread until a modal dialog is displayed. Returns true on | 110 // Block the thread until a modal dialog is displayed. Returns true on |
106 // success. | 111 // success. |
107 bool WaitForAppModalDialog(int wait_timeout); | 112 bool WaitForAppModalDialog(int wait_timeout); |
108 | 113 |
109 // Block the thread until one of the tabs in any window (including windows | 114 // Block the thread until one of the tabs in any window (including windows |
110 // opened after the call) displays given url. Returns true on success. | 115 // opened after the call) displays given url. Returns true on success. |
111 bool WaitForURLDisplayed(GURL url, int wait_timeout); | 116 bool WaitForURLDisplayed(GURL url, int wait_timeout); |
112 | 117 |
113 // Returns the BrowserProxy for the browser window at the given index, | 118 // Returns the BrowserProxy for the browser window at the given index, |
114 // transferring ownership of the pointer to the caller. | 119 // transferring ownership of the pointer to the caller. |
115 // On failure, returns NULL. | 120 // On failure, returns NULL. |
116 // | 121 // |
117 // Use GetBrowserWindowCount to see how many browser windows you can ask for. | 122 // Use GetBrowserWindowCount to see how many browser windows you can ask for. |
118 // Window numbers are 0-based. | 123 // Window numbers are 0-based. |
119 BrowserProxy* GetBrowserWindow(int window_index); | 124 BrowserProxy* GetBrowserWindow(int window_index); |
120 | 125 |
| 126 // Finds the first browser window that is not incognito mode and of type |
| 127 // TYPE_NORMAL, and returns its corresponding BrowserProxy, transferring |
| 128 // ownership of the pointer to the caller. |
| 129 // On failure, returns NULL. |
| 130 BrowserProxy* FindNormalBrowserWindow(); |
| 131 |
121 // Returns the BrowserProxy for the browser window which was last active, | 132 // Returns the BrowserProxy for the browser window which was last active, |
122 // transferring ownership of the pointer to the caller. | 133 // transferring ownership of the pointer to the caller. |
123 // TODO: If there was no last active browser window, or the last active | 134 // TODO: If there was no last active browser window, or the last active |
124 // browser window no longer exists (for example, if it was closed), | 135 // browser window no longer exists (for example, if it was closed), |
125 // returns GetBrowserWindow(0). See crbug.com/10501. As for now this | 136 // returns GetBrowserWindow(0). See crbug.com/10501. As for now this |
126 // function is flakey. | 137 // function is flakey. |
127 BrowserProxy* GetLastActiveBrowserWindow(); | 138 BrowserProxy* GetLastActiveBrowserWindow(); |
128 | 139 |
129 // Returns the WindowProxy for the currently active window, transferring | 140 // Returns the WindowProxy for the currently active window, transferring |
130 // ownership of the pointer to the caller. | 141 // ownership of the pointer to the caller. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // a version resource. | 244 // a version resource. |
234 bool perform_version_check_; | 245 bool perform_version_check_; |
235 | 246 |
236 // Delay to let the browser execute the command. | 247 // Delay to let the browser execute the command. |
237 base::TimeDelta command_execution_timeout_; | 248 base::TimeDelta command_execution_timeout_; |
238 | 249 |
239 DISALLOW_COPY_AND_ASSIGN(AutomationProxy); | 250 DISALLOW_COPY_AND_ASSIGN(AutomationProxy); |
240 }; | 251 }; |
241 | 252 |
242 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ | 253 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ |
OLD | NEW |