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

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

Issue 222873002: Remove pyauto tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 6 years, 8 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
« no previous file with comments | « chrome/test/pyautolib/pyautolib.cc ('k') | chrome/test/pyautolib/remote_host.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // Swig Interface for PyAuto.
6 // PyAuto makes the Automation Proxy interface available in Python
7 //
8 // Running swig as:
9 // swig -python -c++ chrome/test/pyautolib/pyautolib.i
10 // would generate pyautolib.py, pyautolib_wrap.cxx
11
12 // When adding a new class or method, make sure you specify the doc string using
13 // %feature("docstring", "doc string goes here") NODENAME;
14 // and attach it to your node (class or method). This doc string will be
15 // copied over in the generated python classes/methods.
16
17 %module(docstring="Python interface to Automation Proxy.") pyautolib
18 %feature("autodoc", "1");
19
20 %include <cpointer.i>
21 %include <std_string.i>
22 %include <std_wstring.i>
23
24 %include "chrome/test/pyautolib/argc_argv.i"
25
26 // NOTE: All files included in this file should also be listed under
27 // pyautolib_sources in chrome_tests.gypi.
28
29 // Headers that can be swigged directly.
30 %include "chrome/app/chrome_command_ids.h"
31 %include "chrome/app/chrome_dll_resource.h"
32 %include "chrome/common/automation_constants.h"
33 %include "chrome/common/pref_names.h"
34 %include "content/public/common/page_type.h"
35 %include "content/public/common/security_style.h"
36 // Must come before cert_status_flags.h
37 %include "net/base/net_export.h"
38 %ignore net::MapNetErrorToCertStatus(int);
39 %include "net/cert/cert_status_flags.h"
40
41 %{
42 #include "chrome/common/automation_constants.h"
43 #include "chrome/common/pref_names.h"
44 #include "chrome/test/automation/browser_proxy.h"
45 #include "chrome/test/automation/tab_proxy.h"
46 #include "chrome/test/pyautolib/pyautolib.h"
47 #include "content/public/common/security_style.h"
48 #include "net/test/spawned_test_server/spawned_test_server.h"
49 %}
50
51 // Handle type uint32 conversions as int
52 %apply int { uint32 };
53
54 // scoped_refptr
55 template <class T>
56 class scoped_refptr {
57 public:
58 scoped_refptr();
59 scoped_refptr(T* p);
60 ~scoped_refptr();
61
62 T* get() const;
63 T* operator->() const;
64 };
65
66 // GURL
67 %feature("docstring", "Represent a URL. Call spec() to get the string.") GURL;
68 class GURL {
69 public:
70 GURL();
71 explicit GURL(const std::string& url_string);
72 %feature("docstring", "Get the string representation.") spec;
73 const std::string& spec() const;
74 };
75
76 // FilePath
77 namespace base {
78 %feature("docstring",
79 "Represent a file path. Call value() to get the string.") FilePath;
80 class FilePath {
81 public:
82 %feature("docstring", "Get the string representation.") value;
83 #ifdef SWIGWIN
84 typedef std::wstring StringType;
85 #else
86 typedef std::string StringType;
87 #endif // SWIGWIN
88 const StringType& value() const;
89 %feature("docstring", "Construct an empty FilePath from a string.")
90 FilePath;
91 FilePath();
92 explicit FilePath(const StringType& path);
93 };
94 } // namespace base
95
96 class PyUITestSuiteBase {
97 public:
98 %feature("docstring", "Create the suite.") PyUITestSuiteBase;
99 PyUITestSuiteBase(int argc, char** argv);
100 virtual ~PyUITestSuiteBase();
101
102 %feature("docstring", "Initialize from the path to browser dir.")
103 InitializeWithPath;
104 void InitializeWithPath(const base::FilePath& browser_dir);
105 %feature("docstring", "Set chrome source root path, used in some tests")
106 SetCrSourceRoot;
107 void SetCrSourceRoot(const base::FilePath& path);
108 };
109
110 class PyUITestBase {
111 public:
112 PyUITestBase(bool clear_profile, std::wstring homepage);
113
114 %feature("docstring", "Initialize the entire setup. Should be called "
115 "before launching the browser. For internal use.") Initialize;
116 void Initialize(const base::FilePath& browser_dir);
117
118 %feature("docstring", "Appends a command-line switch (with associated value "
119 "if given) to the list of switches to be passed to the browser "
120 "upon launch. Should be called before launching the browser. "
121 "For internal use only.")
122 AppendBrowserLaunchSwitch;
123 void AppendBrowserLaunchSwitch(const char* name);
124 void AppendBrowserLaunchSwitch(const char* name, const char* value);
125
126 %feature("docstring", "Begins tracing with the given category_patterns "
127 "string.")
128 BeginTracing;
129 bool BeginTracing(const std::string& category_patterns);
130
131 %feature("docstring", "Ends tracing and returns the collected events.")
132 EndTracing;
133 std::string EndTracing();
134
135 void UseNamedChannelID(const std::string& named_channel_id);
136
137 %feature("docstring",
138 "Fires up the browser and opens a window.") SetUp;
139 virtual void SetUp();
140 %feature("docstring",
141 "Closes all windows and destroys the browser.") TearDown;
142 virtual void TearDown();
143
144 %feature("docstring", "Launches the browser and IPC testing server.")
145 LaunchBrowserAndServer;
146 void LaunchBrowserAndServer();
147 %feature("docstring", "Closes the browser and IPC testing server.")
148 CloseBrowserAndServer;
149 void CloseBrowserAndServer();
150
151 %feature("docstring", "Determine if the profile is set to be cleared on "
152 "next startup.") get_clear_profile;
153 bool get_clear_profile() const;
154 %feature("docstring", "If False, sets the flag so that the profile is "
155 "not cleared on next startup. Useful for persisting profile "
156 "across restarts. By default the state is True, to clear profile.")
157 set_clear_profile;
158 void set_clear_profile(bool clear_profile);
159
160 %feature("docstring", "Get the path to profile directory.") user_data_dir;
161 base::FilePath user_data_dir() const;
162
163 // Meta-method
164 %feature("docstring", "Send a sync JSON request to Chrome. "
165 "Returns a JSON dict as a response. "
166 "Given timeout in milliseconds."
167 "Internal method.")
168 _SendJSONRequest;
169 std::string _SendJSONRequest(int window_index,
170 const std::string& request,
171 int timeout);
172
173 %feature("docstring",
174 "Returns empty string if there were no unexpected Chrome asserts or "
175 "crashes, a string describing the failures otherwise. As a side "
176 "effect, it will fail with EXPECT_EQ macros if this code runs "
177 "within a gtest harness.") GetErrorsAndCrashes;
178 std::string CheckErrorsAndCrashes() const;
179 };
180
181 namespace net {
182 // SpawnedTestServer
183 %feature("docstring",
184 "SpawnedTestServer. Serves files in data dir over a local http server")
185 SpawnedTestServer;
186 class SpawnedTestServer {
187 public:
188 enum Type {
189 TYPE_FTP,
190 TYPE_HTTP,
191 TYPE_HTTPS,
192 };
193
194 // Initialize a SpawnedTestServer listening on the specified host
195 // (IP or hostname).
196 SpawnedTestServer(Type type, const std::string& host,
197 const base::FilePath& document_root);
198 // Initialize a SpawnedTestServer with a specific set of SSLOptions.
199 SpawnedTestServer(Type type,
200 const SSLOptions& ssl_options,
201 const base::FilePath& document_root);
202
203 %feature("docstring", "Start SpawnedTestServer over an ephemeral port") Start;
204 bool Start();
205
206 %feature("docstring", "Stop SpawnedTestServer") Stop;
207 bool Stop();
208
209 %feature("docstring", "Get FilePath to the document root") document_root;
210 const base::FilePath& document_root() const;
211
212 std::string GetScheme() const;
213
214 %feature("docstring", "Get URL for a file path") GetURL;
215 GURL GetURL(const std::string& path) const;
216 };
217
218 %extend SpawnedTestServer {
219 %feature("docstring", "Get port number.") GetPort;
220 int GetPort() const {
221 int val = 0;
222 $self->server_data().GetInteger("port", &val);
223 return val;
224 }
225 };
226
227 }
228 // SSLOptions
229 %feature("docstring",
230 "SSLOptions. Sets one of three types of a cert")
231 SSLOptions;
232 struct SSLOptions {
233 enum ServerCertificate {
234 CERT_OK,
235 CERT_MISMATCHED_NAME,
236 CERT_EXPIRED,
237 };
238
239 // Initialize a new SSLOptions that will use the specified certificate.
240 explicit SSLOptions(ServerCertificate cert);
241 };
242
243 %{
244 typedef net::SpawnedTestServer::SSLOptions SSLOptions;
245 %}
246
247 %pointer_class(int, int_ptr);
248 %pointer_class(uint32, uint32_ptr);
OLDNEW
« no previous file with comments | « chrome/test/pyautolib/pyautolib.cc ('k') | chrome/test/pyautolib/remote_host.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698