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_AUTOMATION_BROWSER_PROXY_H_ | 5 #ifndef CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
6 #define CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ | 6 #define CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 // Checks to see if a command is enabled or not. If the call was successful, | 45 // Checks to see if a command is enabled or not. If the call was successful, |
46 // puts the result in |enabled| and returns true. | 46 // puts the result in |enabled| and returns true. |
47 bool IsMenuCommandEnabled(int id, bool* enabled) WARN_UNUSED_RESULT; | 47 bool IsMenuCommandEnabled(int id, bool* enabled) WARN_UNUSED_RESULT; |
48 | 48 |
49 // Append a new tab to the TabStrip. The new tab is selected. | 49 // Append a new tab to the TabStrip. The new tab is selected. |
50 // The new tab navigates to the given tab_url. | 50 // The new tab navigates to the given tab_url. |
51 // Returns true if successful. | 51 // Returns true if successful. |
52 bool AppendTab(const GURL& tab_url) WARN_UNUSED_RESULT; | 52 bool AppendTab(const GURL& tab_url) WARN_UNUSED_RESULT; |
53 | 53 |
54 // Appends a new tab in the background (as if middle-clicking). | |
55 bool AppendBackgroundTab(const GURL& tab_url) WARN_UNUSED_RESULT; | |
56 | |
57 // Gets the (zero-based) index of the currently active tab. Returns true if | 54 // Gets the (zero-based) index of the currently active tab. Returns true if |
58 // successful. | 55 // successful. |
59 bool GetActiveTabIndex(int* active_tab_index) const WARN_UNUSED_RESULT; | 56 bool GetActiveTabIndex(int* active_tab_index) const WARN_UNUSED_RESULT; |
60 | 57 |
61 // Returns the number of tabs in the given window. Returns true if | 58 // Returns the number of tabs in the given window. Returns true if |
62 // the call was successful. | 59 // the call was successful. |
63 bool GetTabCount(int* num_tabs) const WARN_UNUSED_RESULT; | 60 bool GetTabCount(int* num_tabs) const WARN_UNUSED_RESULT; |
64 | 61 |
65 // Returns the type of the given window. Returns true if the call was | 62 // Returns the type of the given window. Returns true if the call was |
66 // successful. | 63 // successful. |
67 bool GetType(Browser::Type* type) const WARN_UNUSED_RESULT; | 64 bool GetType(Browser::Type* type) const WARN_UNUSED_RESULT; |
68 | 65 |
69 // Sets |is_application| to whether the browser is currently in application | |
70 // mode. | |
71 bool IsApplication(bool* is_application) WARN_UNUSED_RESULT; | |
72 | |
73 // Returns the TabProxy for the tab at the given index, transferring | 66 // Returns the TabProxy for the tab at the given index, transferring |
74 // ownership of the pointer to the caller. On failure, returns NULL. | 67 // ownership of the pointer to the caller. On failure, returns NULL. |
75 // | 68 // |
76 // Use GetTabCount to see how many windows you can ask for. Tab numbers | 69 // Use GetTabCount to see how many windows you can ask for. Tab numbers |
77 // are 0-based. | 70 // are 0-based. |
78 scoped_refptr<TabProxy> GetTab(int tab_index) const; | 71 scoped_refptr<TabProxy> GetTab(int tab_index) const; |
79 | 72 |
80 // Returns the TabProxy for the currently active tab, transferring | 73 // Returns the TabProxy for the currently active tab, transferring |
81 // ownership of the pointer to the caller. On failure, returns NULL. | 74 // ownership of the pointer to the caller. On failure, returns NULL. |
82 scoped_refptr<TabProxy> GetActiveTab() const; | 75 scoped_refptr<TabProxy> GetActiveTab() const; |
(...skipping 30 matching lines...) Expand all Loading... |
113 | 106 |
114 // Block the thread until the specified tab is the active tab. | 107 // Block the thread until the specified tab is the active tab. |
115 // |wait_timeout| is the timeout, in milliseconds, for waiting. | 108 // |wait_timeout| is the timeout, in milliseconds, for waiting. |
116 // Returns false if the tab does not become active. | 109 // Returns false if the tab does not become active. |
117 bool WaitForTabToBecomeActive(int tab, int wait_timeout) WARN_UNUSED_RESULT; | 110 bool WaitForTabToBecomeActive(int tab, int wait_timeout) WARN_UNUSED_RESULT; |
118 | 111 |
119 // Opens the FindInPage box. Note: If you just want to search within a tab | 112 // Opens the FindInPage box. Note: If you just want to search within a tab |
120 // you don't need to call this function, just use FindInPage(...) directly. | 113 // you don't need to call this function, just use FindInPage(...) directly. |
121 bool OpenFindInPage() WARN_UNUSED_RESULT; | 114 bool OpenFindInPage() WARN_UNUSED_RESULT; |
122 | 115 |
123 // Get the x, y coordinates for the Find window. If animating, |x| and |y| | |
124 // will be -1, -1. Returns false on failure. | |
125 bool GetFindWindowLocation(int* x, int* y) WARN_UNUSED_RESULT; | |
126 | |
127 // Returns whether the Find window is fully visible If animating, |is_visible| | 116 // Returns whether the Find window is fully visible If animating, |is_visible| |
128 // will be false. Returns false on failure. | 117 // will be false. Returns false on failure. |
129 bool IsFindWindowFullyVisible(bool* is_visible) WARN_UNUSED_RESULT; | 118 bool IsFindWindowFullyVisible(bool* is_visible) WARN_UNUSED_RESULT; |
130 | 119 |
131 // Run the specified command in the browser | 120 // Run the specified command in the browser |
132 // (see Browser::ExecuteCommandWithDisposition() for the list of supported | 121 // (see Browser::ExecuteCommandWithDisposition() for the list of supported |
133 // commands). Returns true if the command was successfully dispatched, | 122 // commands). Returns true if the command was successfully dispatched, |
134 // false otherwise. | 123 // false otherwise. |
135 bool RunCommandAsync(int browser_command) const WARN_UNUSED_RESULT; | 124 bool RunCommandAsync(int browser_command) const WARN_UNUSED_RESULT; |
136 | 125 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 bool RemoveBookmark(int64 id) WARN_UNUSED_RESULT; | 159 bool RemoveBookmark(int64 id) WARN_UNUSED_RESULT; |
171 | 160 |
172 // Fills |*is_visible| with whether the browser's download shelf is currently | 161 // Fills |*is_visible| with whether the browser's download shelf is currently |
173 // visible. The return value indicates success. On failure, |*is_visible| is | 162 // visible. The return value indicates success. On failure, |*is_visible| is |
174 // unchanged. | 163 // unchanged. |
175 bool IsShelfVisible(bool* is_visible) WARN_UNUSED_RESULT; | 164 bool IsShelfVisible(bool* is_visible) WARN_UNUSED_RESULT; |
176 | 165 |
177 // Shows or hides the download shelf. | 166 // Shows or hides the download shelf. |
178 bool SetShelfVisible(bool is_visible) WARN_UNUSED_RESULT; | 167 bool SetShelfVisible(bool is_visible) WARN_UNUSED_RESULT; |
179 | 168 |
180 // Sets the int value of the specified preference. | |
181 bool SetIntPreference(const std::string& name, int value) WARN_UNUSED_RESULT; | |
182 | |
183 // Sets the string value of the specified preference. | |
184 bool SetStringPreference(const std::string& name, | |
185 const std::string& value) WARN_UNUSED_RESULT; | |
186 | |
187 // Gets the boolean value of the specified preference. | |
188 bool GetBooleanPreference(const std::string& name, | |
189 bool* value) WARN_UNUSED_RESULT; | |
190 | |
191 // Sets the boolean value of the specified preference. | |
192 bool SetBooleanPreference(const std::string& name, | |
193 bool value) WARN_UNUSED_RESULT; | |
194 | |
195 // Sets default content settings. | |
196 bool SetDefaultContentSetting(ContentSettingsType content_type, | |
197 ContentSetting setting) WARN_UNUSED_RESULT; | |
198 | |
199 // Sets content settings for a particular host (overriding the default). | |
200 bool SetContentSetting(const std::string& host, | |
201 ContentSettingsType content_type, | |
202 ContentSetting setting) WARN_UNUSED_RESULT; | |
203 | |
204 // Simulates a termination the browser session (as if the user logged off the | 169 // Simulates a termination the browser session (as if the user logged off the |
205 // mahine). | 170 // mahine). |
206 bool TerminateSession() WARN_UNUSED_RESULT; | 171 bool TerminateSession() WARN_UNUSED_RESULT; |
207 | 172 |
208 // Sets |is_fullscreen| to whether the browser is currently in fullscreen | |
209 // mode. | |
210 bool IsFullscreen(bool* is_fullscreen) WARN_UNUSED_RESULT; | |
211 | |
212 // Sets |is_visible| to whether the browser's fullscreen bubble is visible. | |
213 bool IsFullscreenBubbleVisible(bool* is_visible) WARN_UNUSED_RESULT; | |
214 | |
215 // Shuts down the session service for the browser's profile. Returns true | |
216 // on success. | |
217 bool ShutdownSessionService() WARN_UNUSED_RESULT; | |
218 | |
219 // Generic pattern for sending automation requests. | 173 // Generic pattern for sending automation requests. |
220 bool SendJSONRequest(const std::string& request, | 174 bool SendJSONRequest(const std::string& request, |
221 int timeout_ms, | 175 int timeout_ms, |
222 std::string* response) WARN_UNUSED_RESULT; | 176 std::string* response) WARN_UNUSED_RESULT; |
223 | 177 |
224 // Gets the load times for all tabs started from the command line. | 178 // Gets the load times for all tabs started from the command line. |
225 // Puts the time of the first tab to start loading into |min_start_time|, | 179 // Puts the time of the first tab to start loading into |min_start_time|, |
226 // the time when loading stopped into |max_stop_time| (should be similar to | 180 // the time when loading stopped into |max_stop_time| (should be similar to |
227 // the delay that WaitForInitialLoads waits for), and a list of all | 181 // the delay that WaitForInitialLoads waits for), and a list of all |
228 // finished timestamps into |stop_times|. Returns true on success. | 182 // finished timestamps into |stop_times|. Returns true on success. |
229 bool GetInitialLoadTimes( | 183 bool GetInitialLoadTimes( |
230 int timeout_ms, | 184 int timeout_ms, |
231 float* min_start_time, | 185 float* min_start_time, |
232 float* max_stop_time, | 186 float* max_stop_time, |
233 std::vector<float>* stop_times); | 187 std::vector<float>* stop_times); |
234 | 188 |
235 | 189 |
236 protected: | 190 protected: |
237 virtual ~BrowserProxy() {} | 191 virtual ~BrowserProxy() {} |
238 private: | 192 private: |
239 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); | 193 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); |
240 }; | 194 }; |
241 | 195 |
242 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ | 196 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
OLD | NEW |