OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 %feature("docstring", "Represent a URL. Call spec() to get the string.") GURL; | 74 %feature("docstring", "Represent a URL. Call spec() to get the string.") GURL; |
75 class GURL { | 75 class GURL { |
76 public: | 76 public: |
77 GURL(); | 77 GURL(); |
78 explicit GURL(const std::string& url_string); | 78 explicit GURL(const std::string& url_string); |
79 %feature("docstring", "Get the string representation.") spec; | 79 %feature("docstring", "Get the string representation.") spec; |
80 const std::string& spec() const; | 80 const std::string& spec() const; |
81 }; | 81 }; |
82 | 82 |
83 // FilePath | 83 // FilePath |
| 84 namespace base { |
84 %feature("docstring", | 85 %feature("docstring", |
85 "Represent a file path. Call value() to get the string.") FilePath; | 86 "Represent a file path. Call value() to get the string.") FilePath; |
86 class FilePath { | 87 class FilePath { |
87 public: | 88 public: |
88 %feature("docstring", "Get the string representation.") value; | 89 %feature("docstring", "Get the string representation.") value; |
89 #ifdef SWIGWIN | 90 #ifdef SWIGWIN |
90 typedef std::wstring StringType; | 91 typedef std::wstring StringType; |
91 #else | 92 #else |
92 typedef std::string StringType; | 93 typedef std::string StringType; |
93 #endif // SWIGWIN | 94 #endif // SWIGWIN |
94 const StringType& value() const; | 95 const StringType& value() const; |
95 %feature("docstring", "Construct an empty FilePath from a string.") | 96 %feature("docstring", "Construct an empty FilePath from a string.") |
96 FilePath; | 97 FilePath; |
97 FilePath(); | 98 FilePath(); |
98 explicit FilePath(const StringType& path); | 99 explicit FilePath(const StringType& path); |
99 }; | 100 }; |
| 101 } // namespace base |
100 | 102 |
101 class PyUITestSuiteBase { | 103 class PyUITestSuiteBase { |
102 public: | 104 public: |
103 %feature("docstring", "Create the suite.") PyUITestSuiteBase; | 105 %feature("docstring", "Create the suite.") PyUITestSuiteBase; |
104 PyUITestSuiteBase(int argc, char** argv); | 106 PyUITestSuiteBase(int argc, char** argv); |
105 virtual ~PyUITestSuiteBase(); | 107 virtual ~PyUITestSuiteBase(); |
106 | 108 |
107 %feature("docstring", "Initialize from the path to browser dir.") | 109 %feature("docstring", "Initialize from the path to browser dir.") |
108 InitializeWithPath; | 110 InitializeWithPath; |
109 void InitializeWithPath(const FilePath& browser_dir); | 111 void InitializeWithPath(const base::FilePath& browser_dir); |
110 %feature("docstring", "Set chrome source root path, used in some tests") | 112 %feature("docstring", "Set chrome source root path, used in some tests") |
111 SetCrSourceRoot; | 113 SetCrSourceRoot; |
112 void SetCrSourceRoot(const FilePath& path); | 114 void SetCrSourceRoot(const base::FilePath& path); |
113 }; | 115 }; |
114 | 116 |
115 class PyUITestBase { | 117 class PyUITestBase { |
116 public: | 118 public: |
117 PyUITestBase(bool clear_profile, std::wstring homepage); | 119 PyUITestBase(bool clear_profile, std::wstring homepage); |
118 | 120 |
119 %feature("docstring", "Initialize the entire setup. Should be called " | 121 %feature("docstring", "Initialize the entire setup. Should be called " |
120 "before launching the browser. For internal use.") Initialize; | 122 "before launching the browser. For internal use.") Initialize; |
121 void Initialize(const FilePath& browser_dir); | 123 void Initialize(const base::FilePath& browser_dir); |
122 | 124 |
123 %feature("docstring", "Appends a command-line switch (with associated value " | 125 %feature("docstring", "Appends a command-line switch (with associated value " |
124 "if given) to the list of switches to be passed to the browser " | 126 "if given) to the list of switches to be passed to the browser " |
125 "upon launch. Should be called before launching the browser. " | 127 "upon launch. Should be called before launching the browser. " |
126 "For internal use only.") | 128 "For internal use only.") |
127 AppendBrowserLaunchSwitch; | 129 AppendBrowserLaunchSwitch; |
128 void AppendBrowserLaunchSwitch(const char* name); | 130 void AppendBrowserLaunchSwitch(const char* name); |
129 void AppendBrowserLaunchSwitch(const char* name, const char* value); | 131 void AppendBrowserLaunchSwitch(const char* name, const char* value); |
130 | 132 |
131 %feature("docstring", "Begins tracing with the given category string.") | 133 %feature("docstring", "Begins tracing with the given category string.") |
(...skipping 23 matching lines...) Expand all Loading... |
155 %feature("docstring", "Determine if the profile is set to be cleared on " | 157 %feature("docstring", "Determine if the profile is set to be cleared on " |
156 "next startup.") get_clear_profile; | 158 "next startup.") get_clear_profile; |
157 bool get_clear_profile() const; | 159 bool get_clear_profile() const; |
158 %feature("docstring", "If False, sets the flag so that the profile is " | 160 %feature("docstring", "If False, sets the flag so that the profile is " |
159 "not cleared on next startup. Useful for persisting profile " | 161 "not cleared on next startup. Useful for persisting profile " |
160 "across restarts. By default the state is True, to clear profile.") | 162 "across restarts. By default the state is True, to clear profile.") |
161 set_clear_profile; | 163 set_clear_profile; |
162 void set_clear_profile(bool clear_profile); | 164 void set_clear_profile(bool clear_profile); |
163 | 165 |
164 %feature("docstring", "Get the path to profile directory.") user_data_dir; | 166 %feature("docstring", "Get the path to profile directory.") user_data_dir; |
165 FilePath user_data_dir() const; | 167 base::FilePath user_data_dir() const; |
166 | 168 |
167 // Meta-method | 169 // Meta-method |
168 %feature("docstring", "Send a sync JSON request to Chrome. " | 170 %feature("docstring", "Send a sync JSON request to Chrome. " |
169 "Returns a JSON dict as a response. " | 171 "Returns a JSON dict as a response. " |
170 "Given timeout in milliseconds." | 172 "Given timeout in milliseconds." |
171 "Internal method.") | 173 "Internal method.") |
172 _SendJSONRequest; | 174 _SendJSONRequest; |
173 std::string _SendJSONRequest(int window_index, | 175 std::string _SendJSONRequest(int window_index, |
174 const std::string& request, | 176 const std::string& request, |
175 int timeout); | 177 int timeout); |
(...skipping 13 matching lines...) Expand all Loading... |
189 TestServer; | 191 TestServer; |
190 class TestServer { | 192 class TestServer { |
191 public: | 193 public: |
192 enum Type { | 194 enum Type { |
193 TYPE_FTP, | 195 TYPE_FTP, |
194 TYPE_HTTP, | 196 TYPE_HTTP, |
195 TYPE_HTTPS, | 197 TYPE_HTTPS, |
196 }; | 198 }; |
197 | 199 |
198 // Initialize a TestServer listening on the specified host (IP or hostname). | 200 // Initialize a TestServer listening on the specified host (IP or hostname). |
199 TestServer(Type type, const std::string& host, const FilePath& document_root); | 201 TestServer(Type type, const std::string& host, |
| 202 const base::FilePath& document_root); |
200 // Initialize a TestServer with a specific set of SSLOptions. | 203 // Initialize a TestServer with a specific set of SSLOptions. |
201 TestServer(Type type, | 204 TestServer(Type type, |
202 const SSLOptions& ssl_options, | 205 const SSLOptions& ssl_options, |
203 const FilePath& document_root); | 206 const base::FilePath& document_root); |
204 | 207 |
205 %feature("docstring", "Start TestServer over an ephemeral port") Start; | 208 %feature("docstring", "Start TestServer over an ephemeral port") Start; |
206 bool Start(); | 209 bool Start(); |
207 | 210 |
208 %feature("docstring", "Stop TestServer") Stop; | 211 %feature("docstring", "Stop TestServer") Stop; |
209 bool Stop(); | 212 bool Stop(); |
210 | 213 |
211 %feature("docstring", "Get FilePath to the document root") document_root; | 214 %feature("docstring", "Get FilePath to the document root") document_root; |
212 const FilePath& document_root() const; | 215 const base::FilePath& document_root() const; |
213 | 216 |
214 std::string GetScheme() const; | 217 std::string GetScheme() const; |
215 | 218 |
216 %feature("docstring", "Get URL for a file path") GetURL; | 219 %feature("docstring", "Get URL for a file path") GetURL; |
217 GURL GetURL(const std::string& path) const; | 220 GURL GetURL(const std::string& path) const; |
218 }; | 221 }; |
219 | 222 |
220 %extend TestServer { | 223 %extend TestServer { |
221 %feature("docstring", "Get port number.") GetPort; | 224 %feature("docstring", "Get port number.") GetPort; |
222 int GetPort() const { | 225 int GetPort() const { |
(...skipping 18 matching lines...) Expand all Loading... |
241 // Initialize a new SSLOptions that will use the specified certificate. | 244 // Initialize a new SSLOptions that will use the specified certificate. |
242 explicit SSLOptions(ServerCertificate cert); | 245 explicit SSLOptions(ServerCertificate cert); |
243 }; | 246 }; |
244 | 247 |
245 %{ | 248 %{ |
246 typedef net::TestServer::SSLOptions SSLOptions; | 249 typedef net::TestServer::SSLOptions SSLOptions; |
247 %} | 250 %} |
248 | 251 |
249 %pointer_class(int, int_ptr); | 252 %pointer_class(int, int_ptr); |
250 %pointer_class(uint32, uint32_ptr); | 253 %pointer_class(uint32, uint32_ptr); |
OLD | NEW |