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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = ( | 98 GET_NETWORK_CONDITIONS = ( |
99 _Method.GET, '/session/:sessionId/chromium/network_conditions') | 99 _Method.GET, '/session/:sessionId/chromium/network_conditions') |
100 SET_NETWORK_CONDITIONS = ( | 100 SET_NETWORK_CONDITIONS = ( |
101 _Method.POST, '/session/:sessionId/chromium/network_conditions') | 101 _Method.POST, '/session/:sessionId/chromium/network_conditions') |
| 102 DELETE_NETWORK_CONDITIONS = ( |
| 103 _Method.DELETE, '/session/:sessionId/chromium/network_conditions') |
102 GET_STATUS = (_Method.GET, '/session/:sessionId/application_cache/status') | 104 GET_STATUS = (_Method.GET, '/session/:sessionId/application_cache/status') |
103 IS_BROWSER_ONLINE = (_Method.GET, '/session/:sessionId/browser_connection') | 105 IS_BROWSER_ONLINE = (_Method.GET, '/session/:sessionId/browser_connection') |
104 SET_BROWSER_ONLINE = (_Method.POST, '/session/:sessionId/browser_connection') | 106 SET_BROWSER_ONLINE = (_Method.POST, '/session/:sessionId/browser_connection') |
105 GET_LOCAL_STORAGE_ITEM = ( | 107 GET_LOCAL_STORAGE_ITEM = ( |
106 _Method.GET, '/session/:sessionId/local_storage/key/:key') | 108 _Method.GET, '/session/:sessionId/local_storage/key/:key') |
107 REMOVE_LOCAL_STORAGE_ITEM = ( | 109 REMOVE_LOCAL_STORAGE_ITEM = ( |
108 _Method.DELETE, '/session/:sessionId/local_storage/key/:key') | 110 _Method.DELETE, '/session/:sessionId/local_storage/key/:key') |
109 GET_LOCAL_STORAGE_KEYS = (_Method.GET, '/session/:sessionId/local_storage') | 111 GET_LOCAL_STORAGE_KEYS = (_Method.GET, '/session/:sessionId/local_storage') |
110 SET_LOCAL_STORAGE_ITEM = (_Method.POST, '/session/:sessionId/local_storage') | 112 SET_LOCAL_STORAGE_ITEM = (_Method.POST, '/session/:sessionId/local_storage') |
111 CLEAR_LOCAL_STORAGE = (_Method.DELETE, '/session/:sessionId/local_storage') | 113 CLEAR_LOCAL_STORAGE = (_Method.DELETE, '/session/:sessionId/local_storage') |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 self._http_client.request(command[0], '/'.join(substituted_parts), body) | 174 self._http_client.request(command[0], '/'.join(substituted_parts), body) |
173 response = self._http_client.getresponse() | 175 response = self._http_client.getresponse() |
174 | 176 |
175 if response.status == 303: | 177 if response.status == 303: |
176 self._http_client.request(_Method.GET, response.getheader('location')) | 178 self._http_client.request(_Method.GET, response.getheader('location')) |
177 response = self._http_client.getresponse() | 179 response = self._http_client.getresponse() |
178 if response.status != 200: | 180 if response.status != 200: |
179 raise RuntimeError('Server returned error: ' + response.reason) | 181 raise RuntimeError('Server returned error: ' + response.reason) |
180 | 182 |
181 return json.loads(response.read()) | 183 return json.loads(response.read()) |
OLD | NEW |