Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/test/pyautolib/pyautolib.i

Issue 9535022: Exposed GetSecurityState and GetPageType to pyAuto. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
20 %include <std_wstring.i> 22 %include <std_wstring.i>
21 %include <std_string.i> 23 %include <std_string.i>
dennis_jeffrey 2012/03/09 02:07:47 nit: put the above 4 lines in alphabetical order
dyu1 2012/03/14 19:00:10 Done.
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
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/03/09 02:07:47 nit: swap the above 2 lines to maintain alphabetic
dyu1 2012/03/14 19:00:10 The ordering is correct. If I swap it there will b
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.")
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 "
158 "current tab.")
159 GetSecurityState;
160 PyObject* GetSecurityState() {
161 content::SecurityStyle security_style;
162 net::CertStatus ssl_cert_status;
163 int insecure_content_status;
164 if ($self->GetSecurityState(
165 &security_style, &ssl_cert_status, &insecure_content_status)){
dennis_jeffrey 2012/03/09 02:07:47 add a space before the {
dyu1 2012/03/14 19:00:10 Done.
166 PyObject* result_dict = PyDict_New();
dennis_jeffrey 2012/03/09 02:07:47 move this definition above the loop, then remove l
dyu1 2012/03/14 19:00:10 Done.
167 PyDict_SetItem(result_dict, PyString_FromString("security_style"),
168 PyInt_FromLong(security_style));
169 PyDict_SetItem(result_dict, PyString_FromString("ssl_cert_status"),
170 PyInt_FromLong(ssl_cert_status));
171 PyDict_SetItem(result_dict, PyString_FromString("insecure_content_status") ,
dennis_jeffrey 2012/03/09 02:07:47 make sure this line doesn't exceed 80 chars
dyu1 2012/03/14 19:00:10 Done.
172 PyInt_FromLong(insecure_content_status));
dennis_jeffrey 2012/03/09 02:07:47 Indent lines 167 - 172 by 2 more spaces each
dyu1 2012/03/14 19:00:10 Done.
173 return result_dict;
174 }
175 return PyDict_New();
176 }
177 };
178 %extend {
179 %feature("docstring", "Returns the type of page currently showing "
180 "(normal, interstitial, error.")
181 GetPageType;
182 PyObject* GetPageType(){
183 content::PageType page_type;
184 if ($self->GetPageType(&page_type)){
dennis_jeffrey 2012/03/09 02:07:47 add a space before the {
dyu1 2012/03/14 19:00:10 Done.
185 PyObject* result_dict = PyDict_New();
dennis_jeffrey 2012/03/09 02:07:47 move this line to above the loop, then remove line
dyu1 2012/03/14 19:00:10 Done.
186 PyDict_SetItem(result_dict, PyString_FromString("page_type"),
dennis_jeffrey 2012/03/09 02:07:47 indent this line by 2 more spaces
dyu1 2012/03/14 19:00:10 Done.
187 PyInt_FromLong(page_type));
dennis_jeffrey 2012/03/09 02:07:47 indent this further to line up underneath the firs
dyu1 2012/03/14 19:00:10 Done.
188 return result_dict;
189 }
190 return PyDict_New();
191 }
192 };
150 193
151 // HTTP Auth 194 // HTTP Auth
152 %feature("docstring", 195 %feature("docstring",
153 "Checks if this tab has a login prompt waiting for auth. This will be " 196 "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 " 197 "true if a navigation results in a login prompt, and if an attempted "
155 "login fails. " 198 "login fails. "
156 "Note that this is only valid if you've done a navigation on this same " 199 "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 " 200 "object; different TabProxy objects can refer to the same Tab. Calls "
158 "that can set this are NavigateToURL, GoBack, and GoForward. ") 201 "that can set this are NavigateToURL, GoBack, and GoForward. ")
159 NeedsAuth; 202 NeedsAuth;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 CERT_EXPIRED, 511 CERT_EXPIRED,
469 }; 512 };
470 513
471 // Initialize a new HTTPSOptions that will use the specified certificate. 514 // Initialize a new HTTPSOptions that will use the specified certificate.
472 explicit HTTPSOptions(ServerCertificate cert); 515 explicit HTTPSOptions(ServerCertificate cert);
473 }; 516 };
474 517
475 %{ 518 %{
476 typedef net::TestServer::HTTPSOptions HTTPSOptions; 519 typedef net::TestServer::HTTPSOptions HTTPSOptions;
477 %} 520 %}
521
522 %pointer_class(int, int_ptr);
523 %pointer_class(uint32, uint32_ptr);
OLDNEW
« chrome/test/functional/https.py ('K') | « chrome/test/functional/https.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698