OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Swig Interface for PyAuto. | 5 // Swig Interface for PyAuto. |
6 // PyAuto makes the Automation Proxy interface available in Python | 6 // PyAuto makes the Automation Proxy interface available in Python |
7 // | 7 // |
8 // Running swig as: | 8 // Running swig as: |
9 // swig -python -c++ chrome/test/pyautolib/pyautolib.i | 9 // swig -python -c++ chrome/test/pyautolib/pyautolib.i |
10 // would generate pyautolib.py, pyautolib_wrap.cxx | 10 // would generate pyautolib.py, pyautolib_wrap.cxx |
11 | 11 |
12 // When adding a new class or method, make sure you specify the doc string using | 12 // When adding a new class or method, make sure you specify the doc string using |
13 // %feature("docstring", "doc string goes here") NODENAME; | 13 // %feature("docstring", "doc string goes here") NODENAME; |
14 // and attach it to your node (class or method). This doc string will be | 14 // and attach it to your node (class or method). This doc string will be |
15 // copied over in the generated python classes/methods. | 15 // copied over in the generated python classes/methods. |
16 | 16 |
17 %module(docstring="Python interface to Automtion Proxy.") pyautolib | 17 %module(docstring="Python interface to Automation Proxy.") pyautolib |
18 %feature("autodoc", "1"); | 18 %feature("autodoc", "1"); |
19 | 19 |
20 %include <std_wstring.i> | 20 %include <std_wstring.i> |
21 %include <std_string.i> | 21 %include <std_string.i> |
22 | 22 |
23 %include "chrome/test/pyautolib/argc_argv.i" | 23 %include "chrome/test/pyautolib/argc_argv.i" |
24 | 24 |
25 // NOTE: All files included in this file should also be listed under | 25 // NOTE: All files included in this file should also be listed under |
26 // pyautolib_sources in chrome_tests.gypi. | 26 // pyautolib_sources in chrome_tests.gypi. |
27 | 27 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 "true if a navigation results in a login prompt, and if an attempted " | 145 "true if a navigation results in a login prompt, and if an attempted " |
146 "login fails. " | 146 "login fails. " |
147 "Note that this is only valid if you've done a navigation on this same " | 147 "Note that this is only valid if you've done a navigation on this same " |
148 "object; different TabProxy objects can refer to the same Tab. Calls " | 148 "object; different TabProxy objects can refer to the same Tab. Calls " |
149 "that can set this are NavigateToURL, GoBack, and GoForward. ") | 149 "that can set this are NavigateToURL, GoBack, and GoForward. ") |
150 NeedsAuth; | 150 NeedsAuth; |
151 bool NeedsAuth() const; | 151 bool NeedsAuth() const; |
152 %feature("docstring", "Supply authentication to a login prompt. " | 152 %feature("docstring", "Supply authentication to a login prompt. " |
153 "Blocks until navigation completes or another login prompt appears " | 153 "Blocks until navigation completes or another login prompt appears " |
154 "in the case of failed auth.") SetAuth; | 154 "in the case of failed auth.") SetAuth; |
155 bool SetAuth(const std::wstring& username, const std::wstring& password); | 155 bool SetAuth(const string16& username, const string16& password); |
156 %feature("docstring", "Cancel authentication to a login prompt. ") | 156 %feature("docstring", "Cancel authentication to a login prompt. ") |
157 CancelAuth; | 157 CancelAuth; |
158 bool CancelAuth(); | 158 bool CancelAuth(); |
159 | 159 |
160 }; | 160 }; |
161 | 161 |
162 class PyUITestSuiteBase { | 162 class PyUITestSuiteBase { |
163 public: | 163 public: |
164 %feature("docstring", "Create the suite.") PyUITestSuiteBase; | 164 %feature("docstring", "Create the suite.") PyUITestSuiteBase; |
165 PyUITestSuiteBase(int argc, char** argv); | 165 PyUITestSuiteBase(int argc, char** argv); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 "|wait_for_open| specifies which kind of change we wait for.") | 270 "|wait_for_open| specifies which kind of change we wait for.") |
271 WaitForBookmarkBarVisibilityChange; | 271 WaitForBookmarkBarVisibilityChange; |
272 bool WaitForBookmarkBarVisibilityChange(bool wait_for_open); | 272 bool WaitForBookmarkBarVisibilityChange(bool wait_for_open); |
273 | 273 |
274 %feature("docstring", "Get the bookmarks as a JSON string. Internal method.") | 274 %feature("docstring", "Get the bookmarks as a JSON string. Internal method.") |
275 _GetBookmarksAsJSON; | 275 _GetBookmarksAsJSON; |
276 std::string _GetBookmarksAsJSON(); | 276 std::string _GetBookmarksAsJSON(); |
277 | 277 |
278 %feature("docstring", "Add a bookmark folder with the given index in the paren
t." | 278 %feature("docstring", "Add a bookmark folder with the given index in the paren
t." |
279 " |title| is the title/name of the folder.") AddBookmar
kGroup; | 279 " |title| is the title/name of the folder.") AddBookmar
kGroup; |
280 bool AddBookmarkGroup(std::wstring parent_id, int index, std::wstring title); | 280 bool AddBookmarkGroup(string16 parent_id, int index, string16 title); |
281 | 281 |
282 %feature("docstring", "Add a bookmark with the given title and URL.") AddBookm
arkURL; | 282 %feature("docstring", "Add a bookmark with the given title and URL.") AddBookm
arkURL; |
283 bool AddBookmarkURL(std::wstring parent_id, int index, | 283 bool AddBookmarkURL(string16 parent_id, int index, |
284 std::wstring title, const std::wstring url); | 284 string16 title, const string16 url); |
285 | 285 |
286 %feature("docstring", "Move a bookmark to a new parent.") ReparentBookmark; | 286 %feature("docstring", "Move a bookmark to a new parent.") ReparentBookmark; |
287 bool ReparentBookmark(std::wstring id, std::wstring new_parent_id, int index); | 287 bool ReparentBookmark(string16 id, string16 new_parent_id, int index); |
288 | 288 |
289 %feature("docstring", "Set the title of a bookmark.") SetBookmarkTitle; | 289 %feature("docstring", "Set the title of a bookmark.") SetBookmarkTitle; |
290 bool SetBookmarkTitle(std::wstring id, std::wstring title); | 290 bool SetBookmarkTitle(string16 id, string16 title); |
291 | 291 |
292 %feature("docstring", "Set the URL of a bookmark.") SetBookmarkURL; | 292 %feature("docstring", "Set the URL of a bookmark.") SetBookmarkURL; |
293 bool SetBookmarkURL(std::wstring id, const std::wstring url); | 293 bool SetBookmarkURL(string16 id, string16 url); |
294 | 294 |
295 %feature("docstring", "Remove (delete) a bookmark.") RemoveBookmark; | 295 %feature("docstring", "Remove (delete) a bookmark.") RemoveBookmark; |
296 bool RemoveBookmark(std::wstring id); | 296 bool RemoveBookmark(string16 id); |
297 | 297 |
298 %feature("docstring", "Open the Find box in the given or first browser " | 298 %feature("docstring", "Open the Find box in the given or first browser " |
299 "window.") OpenFindInPage; | 299 "window.") OpenFindInPage; |
300 void OpenFindInPage(int window_index=0); | 300 void OpenFindInPage(int window_index=0); |
301 | 301 |
302 %feature("docstring", "Determine if the find box is visible in the " | 302 %feature("docstring", "Determine if the find box is visible in the " |
303 "given or first browser window.") IsFindInPageVisible; | 303 "given or first browser window.") IsFindInPageVisible; |
304 bool IsFindInPageVisible(int window_index=0); | 304 bool IsFindInPageVisible(int window_index=0); |
305 | 305 |
306 // Tabs and windows methods | 306 // Tabs and windows methods |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 %feature("docstring", "Get FilePath to the document root") document_root; | 418 %feature("docstring", "Get FilePath to the document root") document_root; |
419 const FilePath& document_root() const; | 419 const FilePath& document_root() const; |
420 | 420 |
421 std::string GetScheme() const; | 421 std::string GetScheme() const; |
422 | 422 |
423 %feature("docstring", "Get URL for a file path") GetURL; | 423 %feature("docstring", "Get URL for a file path") GetURL; |
424 GURL GetURL(const std::string& path) const; | 424 GURL GetURL(const std::string& path) const; |
425 }; | 425 }; |
426 } | 426 } |
427 | 427 |
OLD | NEW |