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 // 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 Automation Proxy.") pyautolib | 17 %module(docstring="Python interface to Automation Proxy.") pyautolib |
18 %feature("autodoc", "1"); | 18 %feature("autodoc", "1"); |
19 | 19 |
20 %include "typemaps.i" | |
21 %include "cpointer.i" | |
dennis_jeffrey
2012/02/29 23:37:13
I'm not very familiar with swig syntax. Is there
dyu1
2012/03/05 19:16:46
It works with angle brackets as well but I just us
| |
20 %include <std_wstring.i> | 22 %include <std_wstring.i> |
21 %include <std_string.i> | 23 %include <std_string.i> |
22 | 24 |
23 %include "chrome/test/pyautolib/argc_argv.i" | 25 %include "chrome/test/pyautolib/argc_argv.i" |
24 | 26 |
25 // NOTE: All files included in this file should also be listed under | 27 // NOTE: All files included in this file should also be listed under |
Nirnimesh
2012/02/29 23:41:08
Heed this.
dyu1
2012/03/05 19:16:46
Done.
| |
26 // pyautolib_sources in chrome_tests.gypi. | 28 // pyautolib_sources in chrome_tests.gypi. |
27 | 29 |
28 // Headers that can be swigged directly. | 30 // Headers that can be swigged directly. |
29 %include "chrome/app/chrome_command_ids.h" | 31 %include "chrome/app/chrome_command_ids.h" |
30 %include "chrome/app/chrome_dll_resource.h" | 32 %include "chrome/app/chrome_dll_resource.h" |
31 %include "chrome/common/automation_constants.h" | 33 %include "chrome/common/automation_constants.h" |
32 %include "chrome/common/pref_names.h" | 34 %include "chrome/common/pref_names.h" |
35 %include "content/public/common/page_type.h" | |
36 %include "content/public/common/security_style.h" | |
37 %include "net/base/net_export.h" | |
38 %include "net/base/cert_status_flags.h" | |
dennis_jeffrey
2012/02/29 23:37:13
swap the above 2 lines to put them in alphabetical
dyu1
2012/03/05 19:16:46
If I swap the two include lines from above I get a
| |
33 | 39 |
34 %{ | 40 %{ |
35 #include "chrome/common/automation_constants.h" | 41 #include "chrome/common/automation_constants.h" |
36 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
37 #include "chrome/test/automation/browser_proxy.h" | 43 #include "chrome/test/automation/browser_proxy.h" |
38 #include "chrome/test/automation/tab_proxy.h" | 44 #include "chrome/test/automation/tab_proxy.h" |
39 #include "chrome/test/pyautolib/pyautolib.h" | 45 #include "chrome/test/pyautolib/pyautolib.h" |
40 #include "net/test/test_server.h" | 46 #include "net/test/test_server.h" |
41 %} | 47 %} |
42 | 48 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 "until the tab has closed, else it'll wait only until the call " | 143 "until the tab has closed, else it'll wait only until the call " |
138 "has been initiated. Be careful while closing the last tab " | 144 "has been initiated. Be careful while closing the last tab " |
139 "since it might close the browser.") Close; | 145 "since it might close the browser.") Close; |
140 bool Close(); | 146 bool Close(); |
141 bool Close(bool wait_until_closed); | 147 bool Close(bool wait_until_closed); |
142 %feature("docstring", "Blocks until tab is completely restored.") | 148 %feature("docstring", "Blocks until tab is completely restored.") |
143 WaitForTabToBeRestored; | 149 WaitForTabToBeRestored; |
144 bool WaitForTabToBeRestored(uint32 timeout_ms); | 150 bool WaitForTabToBeRestored(uint32 timeout_ms); |
145 %feature("docstring", "Simulates user action on the SSL blocking page." | 151 %feature("docstring", "Simulates user action on the SSL blocking page." |
146 "if |proceed| is true, this is equivalent to clicking the 'Proceed' " | 152 "if |proceed| is true, this is equivalent to clicking the 'Proceed' " |
147 "button, if false to 'Take me out of there' button.") | 153 "button, if false to 'Take me out of there' button.") |
dennis_jeffrey
2012/02/29 23:37:13
indent the above 2 lines by 1 more space each to b
dyu1
2012/03/05 19:16:46
Done.
| |
148 TakeActionOnSSLBlockingPage; | 154 TakeActionOnSSLBlockingPage; |
149 bool TakeActionOnSSLBlockingPage(bool proceed); | 155 bool TakeActionOnSSLBlockingPage(bool proceed); |
156 %extend { | |
157 %feature("docstring", "Retrieves the different security states for the curre nt tab.") | |
anantha
2012/02/29 22:30:02
Indentation doesn't look correct. Can you please c
dennis_jeffrey
2012/02/29 23:37:13
Take a look at how other long docstrings are speci
dyu1
2012/03/05 19:16:46
Done.
dyu1
2012/03/05 19:16:46
Done.
| |
158 GetSecurityState; | |
dennis_jeffrey
2012/02/29 23:37:13
this can probably be moved to the line above, like
dyu1
2012/03/05 19:16:46
In the examples I see, these are added after the d
| |
159 bool GetSecurityState(int *security_style, uint32 *ssl_cert_status, | |
dennis_jeffrey
2012/02/29 23:37:13
move the * over so that it touches the type:
int*
Nirnimesh
2012/02/29 23:41:08
use int*, not int *
(ie, * should go with the type
dyu1
2012/03/05 19:16:46
The Swig doc actually shows the examples this way.
dyu1
2012/03/05 19:16:46
Done.
| |
160 int * insecure_content_status) { | |
dennis_jeffrey
2012/02/29 23:37:13
same comment as line 159 above. Also do the same
Nirnimesh
2012/02/29 23:41:08
int*
dyu1
2012/03/05 19:16:46
Done.
dyu1
2012/03/05 19:16:46
Done.
| |
161 return $self->GetSecurityState(reinterpret_cast<content::SecurityStyle *>(s ecurity_style), | |
Nirnimesh
2012/02/29 23:41:08
reduce to 80 chars per line
Nirnimesh
2012/02/29 23:41:08
Wouldn't it have been easier to implement the meth
dyu1
2012/03/05 19:16:46
Done.
dyu1
2012/03/05 19:16:46
Done.
dyu1
2012/03/05 19:16:46
This is now done. It wasn't easy to implement as t
| |
162 reinterpret_cast<net::CertStatus *>(ssl_cert_status), insecure_content_st atus); | |
163 } | |
164 } | |
165 %extend { | |
166 %feature("docstring", "Returns the type of page currently showing (normal, i nterstitial, error.") | |
dennis_jeffrey
2012/02/29 23:37:13
Make sure lines 161, 162, and 166 don't exceed 80
dyu1
2012/03/05 19:16:46
Done.
| |
167 GetPageType; | |
168 bool GetPageType(int *OUTPUT) { | |
dennis_jeffrey
2012/02/29 23:37:13
OUTPUT --> output
dyu1
2012/03/05 19:16:46
OUTPUT variable is actually a typemap and it canno
| |
169 return $self->GetPageType(reinterpret_cast<content::PageType *>(OUTPUT)); | |
170 } | |
171 } | |
150 | 172 |
151 // HTTP Auth | 173 // HTTP Auth |
152 %feature("docstring", | 174 %feature("docstring", |
153 "Checks if this tab has a login prompt waiting for auth. This will be " | 175 "Checks if this tab has a login prompt waiting for auth. This will be " |
154 "true if a navigation results in a login prompt, and if an attempted " | 176 "true if a navigation results in a login prompt, and if an attempted " |
155 "login fails. " | 177 "login fails. " |
156 "Note that this is only valid if you've done a navigation on this same " | 178 "Note that this is only valid if you've done a navigation on this same " |
157 "object; different TabProxy objects can refer to the same Tab. Calls " | 179 "object; different TabProxy objects can refer to the same Tab. Calls " |
158 "that can set this are NavigateToURL, GoBack, and GoForward. ") | 180 "that can set this are NavigateToURL, GoBack, and GoForward. ") |
159 NeedsAuth; | 181 NeedsAuth; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 CERT_EXPIRED, | 490 CERT_EXPIRED, |
469 }; | 491 }; |
470 | 492 |
471 // Initialize a new HTTPSOptions that will use the specified certificate. | 493 // Initialize a new HTTPSOptions that will use the specified certificate. |
472 explicit HTTPSOptions(ServerCertificate cert); | 494 explicit HTTPSOptions(ServerCertificate cert); |
473 }; | 495 }; |
474 | 496 |
475 %{ | 497 %{ |
476 typedef net::TestServer::HTTPSOptions HTTPSOptions; | 498 typedef net::TestServer::HTTPSOptions HTTPSOptions; |
477 %} | 499 %} |
500 %pointer_class(int, intp); | |
Nirnimesh
2012/02/29 23:41:08
intp -> int_ptr
dyu1
2012/03/05 19:16:46
Done.
| |
501 %pointer_class(uint32, uint32p); | |
dennis_jeffrey
2012/02/29 23:37:13
Just curious: what do these %pointer lines do? Ar
Nirnimesh
2012/02/29 23:41:08
uint32p -> uint32_ptr
dyu1
2012/03/05 19:16:46
Done.
dyu1
2012/03/05 19:16:46
They are required to dereference constants like th
| |
OLD | NEW |