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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // commands). Returns true if the command was successfully dispatched, | 115 // commands). Returns true if the command was successfully dispatched, |
116 // false otherwise. | 116 // false otherwise. |
117 bool RunCommandAsync(int browser_command) const WARN_UNUSED_RESULT; | 117 bool RunCommandAsync(int browser_command) const WARN_UNUSED_RESULT; |
118 | 118 |
119 // Run the specified command in the browser | 119 // Run the specified command in the browser |
120 // (see Browser::ExecuteCommandWithDisposition() for the list of supported | 120 // (see Browser::ExecuteCommandWithDisposition() for the list of supported |
121 // commands). Returns true if the command was successfully dispatched and | 121 // commands). Returns true if the command was successfully dispatched and |
122 // executed, false otherwise. | 122 // executed, false otherwise. |
123 bool RunCommand(int browser_command) const WARN_UNUSED_RESULT; | 123 bool RunCommand(int browser_command) const WARN_UNUSED_RESULT; |
124 | 124 |
125 // Returns whether the Bookmark bar is visible and whether we are animating | |
126 // it into position. Also returns whether it is currently detached from the | |
127 // location bar, as in the NTP. | |
128 // Returns false on failure. | |
129 bool GetBookmarkBarVisibility(bool* is_visible, | |
130 bool* is_animating, | |
131 bool* is_detached) WARN_UNUSED_RESULT; | |
132 | |
133 // Get the bookmarks as a JSON string and put it in |json_string|. | |
134 // Return true on success. | |
135 bool GetBookmarksAsJSON(std::string* json_string) WARN_UNUSED_RESULT; | |
136 | |
137 // Wait for the bookmarks to load. Called implicitly by GetBookmarksAsJSON(). | |
138 bool WaitForBookmarkModelToLoad() WARN_UNUSED_RESULT; | |
139 | |
140 // Editing of the bookmark model. Bookmarks are referenced by id. | |
141 // Bookmark or group (folder) creation: | |
142 bool AddBookmarkGroup(int64 parent_id, int index, | |
143 std::wstring& title) WARN_UNUSED_RESULT; | |
144 bool AddBookmarkURL(int64 parent_id, int index, | |
145 std::wstring& title, const GURL& url) WARN_UNUSED_RESULT; | |
146 // Bookmark editing: | |
147 bool ReparentBookmark(int64 id, int64 new_parent_id, | |
148 int index) WARN_UNUSED_RESULT; | |
149 bool SetBookmarkTitle(int64 id, const std::wstring& title) WARN_UNUSED_RESULT; | |
150 bool SetBookmarkURL(int64 id, const GURL& url) WARN_UNUSED_RESULT; | |
151 // Finally, bookmark deletion: | |
152 bool RemoveBookmark(int64 id) WARN_UNUSED_RESULT; | |
153 | |
154 // Simulates a termination the browser session (as if the user logged off the | 125 // Simulates a termination the browser session (as if the user logged off the |
155 // mahine). | 126 // mahine). |
156 bool TerminateSession() WARN_UNUSED_RESULT; | 127 bool TerminateSession() WARN_UNUSED_RESULT; |
157 | 128 |
158 // Generic pattern for sending automation requests. | 129 // Generic pattern for sending automation requests. |
159 bool SendJSONRequest(const std::string& request, | 130 bool SendJSONRequest(const std::string& request, |
160 int timeout_ms, | 131 int timeout_ms, |
161 std::string* response) WARN_UNUSED_RESULT; | 132 std::string* response) WARN_UNUSED_RESULT; |
162 | 133 |
163 // Gets the load times for all tabs started from the command line. | 134 // Gets the load times for all tabs started from the command line. |
164 // Puts the time of the first tab to start loading into |min_start_time|, | 135 // Puts the time of the first tab to start loading into |min_start_time|, |
165 // the time when loading stopped into |max_stop_time| (should be similar to | 136 // the time when loading stopped into |max_stop_time| (should be similar to |
166 // the delay that WaitForInitialLoads waits for), and a list of all | 137 // the delay that WaitForInitialLoads waits for), and a list of all |
167 // finished timestamps into |stop_times|. Returns true on success. | 138 // finished timestamps into |stop_times|. Returns true on success. |
168 bool GetInitialLoadTimes( | 139 bool GetInitialLoadTimes( |
169 base::TimeDelta timeout, | 140 base::TimeDelta timeout, |
170 float* min_start_time, | 141 float* min_start_time, |
171 float* max_stop_time, | 142 float* max_stop_time, |
172 std::vector<float>* stop_times); | 143 std::vector<float>* stop_times); |
173 | 144 |
174 | 145 |
175 protected: | 146 protected: |
176 virtual ~BrowserProxy() {} | 147 virtual ~BrowserProxy() {} |
177 private: | 148 private: |
178 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); | 149 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); |
179 }; | 150 }; |
180 | 151 |
181 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ | 152 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
OLD | NEW |