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 import httplib | 5 import httplib |
6 import json | 6 import json |
7 | 7 |
8 | 8 |
9 class _Method(object): | 9 class _Method(object): |
10 GET = 'GET' | 10 GET = 'GET' |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 GET_ELEMENT_VALUE_OF_CSS_PROPERTY = ( | 88 GET_ELEMENT_VALUE_OF_CSS_PROPERTY = ( |
89 _Method.GET, '/session/:sessionId/element/:id/css/:propertyName') | 89 _Method.GET, '/session/:sessionId/element/:id/css/:propertyName') |
90 IMPLICITLY_WAIT = ( | 90 IMPLICITLY_WAIT = ( |
91 _Method.POST, '/session/:sessionId/timeouts/implicit_wait') | 91 _Method.POST, '/session/:sessionId/timeouts/implicit_wait') |
92 SET_SCRIPT_TIMEOUT = ( | 92 SET_SCRIPT_TIMEOUT = ( |
93 _Method.POST, '/session/:sessionId/timeouts/async_script') | 93 _Method.POST, '/session/:sessionId/timeouts/async_script') |
94 SET_TIMEOUT = (_Method.POST, '/session/:sessionId/timeouts') | 94 SET_TIMEOUT = (_Method.POST, '/session/:sessionId/timeouts') |
95 EXECUTE_SQL = (_Method.POST, '/session/:sessionId/execute_sql') | 95 EXECUTE_SQL = (_Method.POST, '/session/:sessionId/execute_sql') |
96 GET_LOCATION = (_Method.GET, '/session/:sessionId/location') | 96 GET_LOCATION = (_Method.GET, '/session/:sessionId/location') |
97 SET_LOCATION = (_Method.POST, '/session/:sessionId/location') | 97 SET_LOCATION = (_Method.POST, '/session/:sessionId/location') |
| 98 GET_NETWORK_CONDITIONS = ( |
| 99 _Method.GET, '/session/:sessionId/chromium/network_conditions') |
| 100 SET_NETWORK_CONDITIONS = ( |
| 101 _Method.POST, '/session/:sessionId/chromium/network_conditions') |
98 GET_STATUS = (_Method.GET, '/session/:sessionId/application_cache/status') | 102 GET_STATUS = (_Method.GET, '/session/:sessionId/application_cache/status') |
99 IS_BROWSER_ONLINE = (_Method.GET, '/session/:sessionId/browser_connection') | 103 IS_BROWSER_ONLINE = (_Method.GET, '/session/:sessionId/browser_connection') |
100 SET_BROWSER_ONLINE = (_Method.POST, '/session/:sessionId/browser_connection') | 104 SET_BROWSER_ONLINE = (_Method.POST, '/session/:sessionId/browser_connection') |
101 GET_LOCAL_STORAGE_ITEM = ( | 105 GET_LOCAL_STORAGE_ITEM = ( |
102 _Method.GET, '/session/:sessionId/local_storage/key/:key') | 106 _Method.GET, '/session/:sessionId/local_storage/key/:key') |
103 REMOVE_LOCAL_STORAGE_ITEM = ( | 107 REMOVE_LOCAL_STORAGE_ITEM = ( |
104 _Method.DELETE, '/session/:sessionId/local_storage/key/:key') | 108 _Method.DELETE, '/session/:sessionId/local_storage/key/:key') |
105 GET_LOCAL_STORAGE_KEYS = (_Method.GET, '/session/:sessionId/local_storage') | 109 GET_LOCAL_STORAGE_KEYS = (_Method.GET, '/session/:sessionId/local_storage') |
106 SET_LOCAL_STORAGE_ITEM = (_Method.POST, '/session/:sessionId/local_storage') | 110 SET_LOCAL_STORAGE_ITEM = (_Method.POST, '/session/:sessionId/local_storage') |
107 CLEAR_LOCAL_STORAGE = (_Method.DELETE, '/session/:sessionId/local_storage') | 111 CLEAR_LOCAL_STORAGE = (_Method.DELETE, '/session/:sessionId/local_storage') |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 self._http_client.request(command[0], '/'.join(substituted_parts), body) | 172 self._http_client.request(command[0], '/'.join(substituted_parts), body) |
169 response = self._http_client.getresponse() | 173 response = self._http_client.getresponse() |
170 | 174 |
171 if response.status == 303: | 175 if response.status == 303: |
172 self._http_client.request(_Method.GET, response.getheader('location')) | 176 self._http_client.request(_Method.GET, response.getheader('location')) |
173 response = self._http_client.getresponse() | 177 response = self._http_client.getresponse() |
174 if response.status != 200: | 178 if response.status != 200: |
175 raise RuntimeError('Server returned error: ' + response.reason) | 179 raise RuntimeError('Server returned error: ' + response.reason) |
176 | 180 |
177 return json.loads(response.read()) | 181 return json.loads(response.read()) |
OLD | NEW |