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

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

Issue 10830193: Remove SWIGged use of BrowserProxy and TabProxy from PyAuto tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 template <class T> 54 template <class T>
55 class scoped_refptr { 55 class scoped_refptr {
56 public: 56 public:
57 scoped_refptr(); 57 scoped_refptr();
58 scoped_refptr(T* p); 58 scoped_refptr(T* p);
59 ~scoped_refptr(); 59 ~scoped_refptr();
60 60
61 T* get() const; 61 T* get() const;
62 T* operator->() const; 62 T* operator->() const;
63 }; 63 };
64 %template(scoped_refptr__BrowserProxy) scoped_refptr<BrowserProxy>;
65 %template(scoped_refptr__TabProxy) scoped_refptr<TabProxy>;
66 64
67 // GURL 65 // GURL
68 %feature("docstring", "Represent a URL. Call spec() to get the string.") GURL; 66 %feature("docstring", "Represent a URL. Call spec() to get the string.") GURL;
69 class GURL { 67 class GURL {
70 public: 68 public:
71 GURL(); 69 GURL();
72 explicit GURL(const std::string& url_string); 70 explicit GURL(const std::string& url_string);
73 %feature("docstring", "Get the string representation.") spec; 71 %feature("docstring", "Get the string representation.") spec;
74 const std::string& spec() const; 72 const std::string& spec() const;
75 }; 73 };
76 74
77 // FilePath 75 // FilePath
78 %feature("docstring", 76 %feature("docstring",
79 "Represent a file path. Call value() to get the string.") FilePath; 77 "Represent a file path. Call value() to get the string.") FilePath;
80 class FilePath { 78 class FilePath {
81 public: 79 public:
82 %feature("docstring", "Get the string representation.") value; 80 %feature("docstring", "Get the string representation.") value;
83 #ifdef SWIGWIN 81 #ifdef SWIGWIN
84 typedef std::wstring StringType; 82 typedef std::wstring StringType;
85 #else 83 #else
86 typedef std::string StringType; 84 typedef std::string StringType;
87 #endif // SWIGWIN 85 #endif // SWIGWIN
88 const StringType& value() const; 86 const StringType& value() const;
89 %feature("docstring", "Construct an empty FilePath from a string.") 87 %feature("docstring", "Construct an empty FilePath from a string.")
90 FilePath; 88 FilePath;
91 FilePath(); 89 FilePath();
92 explicit FilePath(const StringType& path); 90 explicit FilePath(const StringType& path);
93 }; 91 };
94 92
95 // BrowserProxy
96 %feature("docstring", "Proxy handle to a browser window.") BrowserProxy;
97 %nodefaultctor BrowserProxy;
98 %nodefaultdtor BrowserProxy;
99 class BrowserProxy {
100 public:
101 %feature("docstring", "Activate the tab at the given zero-based index")
102 ActivateTab;
103 bool ActivateTab(int tab_index);
104
105 %feature("docstring", "Activate the browser's window and bring it to front.")
106 BringToFront;
107 bool BringToFront();
108
109 %feature("docstring", "Get proxy to the tab at the given zero-based index")
110 GetTab;
111 scoped_refptr<TabProxy> GetTab(int tab_index) const;
112 };
113
114 // TabProxy
115 %feature("docstring", "Proxy handle to a tab.") TabProxy;
116 %nodefaultctor TabProxy;
117 %nodefaultdtor TabProxy;
118 class TabProxy {
119 public:
120 // Navigation
121 %feature("docstring", "Navigates to a given GURL. "
122 "Blocks until the navigation completes. ") NavigateToURL;
123 AutomationMsg_NavigationResponseValues NavigateToURL(const GURL& url);
124 %feature("docstring", "Navigates to a given GURL. Blocks until the given "
125 "number of navigations complete.")
126 NavigateToURLBlockUntilNavigationsComplete;
127 AutomationMsg_NavigationResponseValues
128 NavigateToURLBlockUntilNavigationsComplete(
129 const GURL& url, int number_of_navigations);
130 %feature("docstring", "Navigates to a given GURL asynchronously. "
131 "Does not wait for the navigation to complete, or even begin; "
132 "Use NavigateToURL() if you want to wait.") NavigateToURLAsync;
133 bool TabProxy::NavigateToURLAsync(const GURL& url);
134 %feature("docstring", "Equivalent to hitting the Back button. "
135 "Blocks until navigation completes.") GoBack;
136 AutomationMsg_NavigationResponseValues GoBack();
137 %feature("docstring", "Equivalent to hitting the Forward button. "
138 "Blocks until navigation completes.") GoForward;
139 AutomationMsg_NavigationResponseValues GoForward();
140 %feature("docstring", "Equivalent to hitting the Reload button. "
141 "Blocks until navigation completes.") Reload;
142 AutomationMsg_NavigationResponseValues Reload();
143 %feature("docstring", "Closes the tab. Supply True to wait "
144 "until the tab has closed, else it'll wait only until the call "
145 "has been initiated. Be careful while closing the last tab "
146 "since it might close the browser.") Close;
147 bool Close();
148 bool Close(bool wait_until_closed);
149 %feature("docstring", "Blocks until tab is completely restored.")
150 WaitForTabToBeRestored;
151 bool WaitForTabToBeRestored(uint32 timeout_ms);
152 %feature("docstring", "Simulates user action on the SSL blocking page."
153 "if |proceed| is true, this is equivalent to clicking the 'Proceed' "
154 "button, if false to 'Take me out of there' button.")
155 TakeActionOnSSLBlockingPage;
156 bool TakeActionOnSSLBlockingPage(bool proceed);
157 %extend {
158 %feature("docstring", "Retrieves the different security states for the "
159 "current tab.")
160 GetSecurityState;
161 PyObject* GetSecurityState() {
162 content::SecurityStyle security_style;
163 net::CertStatus ssl_cert_status;
164 int insecure_content_status;
165 PyObject* result_dict = PyDict_New();
166 if ($self->GetSecurityState(
167 &security_style, &ssl_cert_status, &insecure_content_status)) {
168 PyDict_SetItem(result_dict, PyString_FromString("security_style"),
169 PyInt_FromLong(security_style));
170 PyDict_SetItem(result_dict, PyString_FromString("ssl_cert_status"),
171 PyInt_FromLong(ssl_cert_status));
172 PyDict_SetItem(result_dict,
173 PyString_FromString("insecure_content_status"),
174 PyInt_FromLong(insecure_content_status));
175 }
176 return result_dict;
177 }
178 };
179 %extend {
180 %feature("docstring", "Returns the type of page currently showing "
181 "(normal, interstitial, error.")
182 GetPageType;
183 PyObject* GetPageType() {
184 content::PageType page_type;
185 PyObject* result_dict = PyDict_New();
186 if ($self->GetPageType(&page_type)) {
187 PyDict_SetItem(result_dict, PyString_FromString("page_type"),
188 PyInt_FromLong(page_type));
189 }
190 return result_dict;
191 }
192 };
193
194 };
195
196 class PyUITestSuiteBase { 93 class PyUITestSuiteBase {
197 public: 94 public:
198 %feature("docstring", "Create the suite.") PyUITestSuiteBase; 95 %feature("docstring", "Create the suite.") PyUITestSuiteBase;
199 PyUITestSuiteBase(int argc, char** argv); 96 PyUITestSuiteBase(int argc, char** argv);
200 virtual ~PyUITestSuiteBase(); 97 virtual ~PyUITestSuiteBase();
201 98
202 %feature("docstring", "Initialize from the path to browser dir.") 99 %feature("docstring", "Initialize from the path to browser dir.")
203 InitializeWithPath; 100 InitializeWithPath;
204 void InitializeWithPath(const FilePath& browser_dir); 101 void InitializeWithPath(const FilePath& browser_dir);
205 %feature("docstring", "Set chrome source root path, used in some tests") 102 %feature("docstring", "Set chrome source root path, used in some tests")
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 %feature("docstring", "Open a new browser window.") OpenNewBrowserWindow; 240 %feature("docstring", "Open a new browser window.") OpenNewBrowserWindow;
344 bool OpenNewBrowserWindow(bool show); 241 bool OpenNewBrowserWindow(bool show);
345 242
346 %feature("docstring", "Close a browser window.") CloseBrowserWindow; 243 %feature("docstring", "Close a browser window.") CloseBrowserWindow;
347 bool CloseBrowserWindow(int window_index); 244 bool CloseBrowserWindow(int window_index);
348 245
349 %feature("docstring", "Fetch the number of browser windows. Includes popups.") 246 %feature("docstring", "Fetch the number of browser windows. Includes popups.")
350 GetBrowserWindowCount; 247 GetBrowserWindowCount;
351 int GetBrowserWindowCount(); 248 int GetBrowserWindowCount();
352 249
353 // Misc methods
354 %feature("docstring", "Get a proxy to the browser window at the given "
355 "zero-based index.") GetBrowserWindow;
356 scoped_refptr<BrowserProxy> GetBrowserWindow(int window_index);
357
358 // Meta-method 250 // Meta-method
359 %feature("docstring", "Send a sync JSON request to Chrome. " 251 %feature("docstring", "Send a sync JSON request to Chrome. "
360 "Returns a JSON dict as a response. " 252 "Returns a JSON dict as a response. "
361 "Given timeout in milliseconds." 253 "Given timeout in milliseconds."
362 "Internal method.") 254 "Internal method.")
363 _SendJSONRequest; 255 _SendJSONRequest;
364 std::string _SendJSONRequest(int window_index, 256 std::string _SendJSONRequest(int window_index,
365 const std::string& request, 257 const std::string& request,
366 int timeout); 258 int timeout);
367 259
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 // Initialize a new HTTPSOptions that will use the specified certificate. 336 // Initialize a new HTTPSOptions that will use the specified certificate.
445 explicit HTTPSOptions(ServerCertificate cert); 337 explicit HTTPSOptions(ServerCertificate cert);
446 }; 338 };
447 339
448 %{ 340 %{
449 typedef net::TestServer::HTTPSOptions HTTPSOptions; 341 typedef net::TestServer::HTTPSOptions HTTPSOptions;
450 %} 342 %}
451 343
452 %pointer_class(int, int_ptr); 344 %pointer_class(int, int_ptr);
453 %pointer_class(uint32, uint32_ptr); 345 %pointer_class(uint32, uint32_ptr);
OLDNEW
« chrome/test/functional/ui_runner.py ('K') | « chrome/test/pyautolib/pyauto.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698