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_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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 : AutomationResourceProxy(tracker, sender, handle) {} | 34 : AutomationResourceProxy(tracker, sender, handle) {} |
35 | 35 |
36 // Activates the tab corresponding to (zero-based) tab_index. Returns true if | 36 // Activates the tab corresponding to (zero-based) tab_index. Returns true if |
37 // successful. | 37 // successful. |
38 bool ActivateTab(int tab_index) WARN_UNUSED_RESULT; | 38 bool ActivateTab(int tab_index) WARN_UNUSED_RESULT; |
39 | 39 |
40 // Bring the browser window to the front, activating it. Returns true on | 40 // Bring the browser window to the front, activating it. Returns true on |
41 // success. | 41 // success. |
42 bool BringToFront() WARN_UNUSED_RESULT; | 42 bool BringToFront() WARN_UNUSED_RESULT; |
43 | 43 |
44 // Checks to see if a command is enabled or not. If the call was successful, | |
45 // puts the result in |enabled| and returns true. | |
46 bool IsMenuCommandEnabled(int id, bool* enabled) WARN_UNUSED_RESULT; | |
47 | |
48 // Append a new tab to the TabStrip. The new tab is selected. | 44 // Append a new tab to the TabStrip. The new tab is selected. |
49 // The new tab navigates to the given tab_url. | 45 // The new tab navigates to the given tab_url. |
50 // Returns true if successful. | 46 // Returns true if successful. |
51 bool AppendTab(const GURL& tab_url) WARN_UNUSED_RESULT; | 47 bool AppendTab(const GURL& tab_url) WARN_UNUSED_RESULT; |
52 | 48 |
53 // Gets the (zero-based) index of the currently active tab. Returns true if | 49 // Gets the (zero-based) index of the currently active tab. Returns true if |
54 // successful. | 50 // successful. |
55 bool GetActiveTabIndex(int* active_tab_index) const WARN_UNUSED_RESULT; | 51 bool GetActiveTabIndex(int* active_tab_index) const WARN_UNUSED_RESULT; |
56 | 52 |
57 // Returns the number of tabs in the given window. Returns true if | 53 // Returns the number of tabs in the given window. Returns true if |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 bool AddBookmarkURL(int64 parent_id, int index, | 148 bool AddBookmarkURL(int64 parent_id, int index, |
153 std::wstring& title, const GURL& url) WARN_UNUSED_RESULT; | 149 std::wstring& title, const GURL& url) WARN_UNUSED_RESULT; |
154 // Bookmark editing: | 150 // Bookmark editing: |
155 bool ReparentBookmark(int64 id, int64 new_parent_id, | 151 bool ReparentBookmark(int64 id, int64 new_parent_id, |
156 int index) WARN_UNUSED_RESULT; | 152 int index) WARN_UNUSED_RESULT; |
157 bool SetBookmarkTitle(int64 id, const std::wstring& title) WARN_UNUSED_RESULT; | 153 bool SetBookmarkTitle(int64 id, const std::wstring& title) WARN_UNUSED_RESULT; |
158 bool SetBookmarkURL(int64 id, const GURL& url) WARN_UNUSED_RESULT; | 154 bool SetBookmarkURL(int64 id, const GURL& url) WARN_UNUSED_RESULT; |
159 // Finally, bookmark deletion: | 155 // Finally, bookmark deletion: |
160 bool RemoveBookmark(int64 id) WARN_UNUSED_RESULT; | 156 bool RemoveBookmark(int64 id) WARN_UNUSED_RESULT; |
161 | 157 |
162 // Fills |*is_visible| with whether the browser's download shelf is currently | |
163 // visible. The return value indicates success. On failure, |*is_visible| is | |
164 // unchanged. | |
165 bool IsShelfVisible(bool* is_visible) WARN_UNUSED_RESULT; | |
166 | |
167 // Shows or hides the download shelf. | |
168 bool SetShelfVisible(bool is_visible) WARN_UNUSED_RESULT; | |
169 | |
170 // Simulates a termination the browser session (as if the user logged off the | 158 // Simulates a termination the browser session (as if the user logged off the |
171 // mahine). | 159 // mahine). |
172 bool TerminateSession() WARN_UNUSED_RESULT; | 160 bool TerminateSession() WARN_UNUSED_RESULT; |
173 | 161 |
174 // Generic pattern for sending automation requests. | 162 // Generic pattern for sending automation requests. |
175 bool SendJSONRequest(const std::string& request, | 163 bool SendJSONRequest(const std::string& request, |
176 int timeout_ms, | 164 int timeout_ms, |
177 std::string* response) WARN_UNUSED_RESULT; | 165 std::string* response) WARN_UNUSED_RESULT; |
178 | 166 |
179 // Gets the load times for all tabs started from the command line. | 167 // Gets the load times for all tabs started from the command line. |
180 // Puts the time of the first tab to start loading into |min_start_time|, | 168 // Puts the time of the first tab to start loading into |min_start_time|, |
181 // the time when loading stopped into |max_stop_time| (should be similar to | 169 // the time when loading stopped into |max_stop_time| (should be similar to |
182 // the delay that WaitForInitialLoads waits for), and a list of all | 170 // the delay that WaitForInitialLoads waits for), and a list of all |
183 // finished timestamps into |stop_times|. Returns true on success. | 171 // finished timestamps into |stop_times|. Returns true on success. |
184 bool GetInitialLoadTimes( | 172 bool GetInitialLoadTimes( |
185 base::TimeDelta timeout, | 173 base::TimeDelta timeout, |
186 float* min_start_time, | 174 float* min_start_time, |
187 float* max_stop_time, | 175 float* max_stop_time, |
188 std::vector<float>* stop_times); | 176 std::vector<float>* stop_times); |
189 | 177 |
190 | 178 |
191 protected: | 179 protected: |
192 virtual ~BrowserProxy() {} | 180 virtual ~BrowserProxy() {} |
193 private: | 181 private: |
194 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); | 182 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); |
195 }; | 183 }; |
196 | 184 |
197 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ | 185 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
OLD | NEW |