| OLD | NEW |
| 1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 HTTP_DIR = "http/tests/" | 223 HTTP_DIR = "http/tests/" |
| 224 HTTP_LOCAL_DIR = "http/tests/local/" | 224 HTTP_LOCAL_DIR = "http/tests/local/" |
| 225 | 225 |
| 226 def is_http_test(self, test_name): | 226 def is_http_test(self, test_name): |
| 227 return test_name.startswith(self.HTTP_DIR) and not test_name.startswith(
self.HTTP_LOCAL_DIR) | 227 return test_name.startswith(self.HTTP_DIR) and not test_name.startswith(
self.HTTP_LOCAL_DIR) |
| 228 | 228 |
| 229 def test_to_uri(self, test_name): | 229 def test_to_uri(self, test_name): |
| 230 """Convert a test name to a URI. | 230 """Convert a test name to a URI. |
| 231 | 231 |
| 232 Tests which have an 'https' directory in their paths (e.g. | 232 Tests which have an 'https' directory in their paths (e.g. |
| 233 '/http/tests/security/mixedContent/https/test1.html') will be loaded | 233 '/http/tests/security/mixedContent/https/test1.html') or '.https.' in |
| 234 over HTTPS; all other tests over HTTP. | 234 their name (e.g. 'http/tests/security/mixedContent/test1.https.html') wi
ll |
| 235 be loaded over HTTPS; all other tests over HTTP. |
| 235 """ | 236 """ |
| 236 if not self.is_http_test(test_name): | 237 if not self.is_http_test(test_name): |
| 237 return path.abspath_to_uri(self._port.host.platform, self._port.absp
ath_for_test(test_name)) | 238 return path.abspath_to_uri(self._port.host.platform, self._port.absp
ath_for_test(test_name)) |
| 238 | 239 |
| 239 relative_path = test_name[len(self.HTTP_DIR):] | 240 relative_path = test_name[len(self.HTTP_DIR):] |
| 240 | 241 |
| 241 if "/https/" in test_name: | 242 if "/https/" in test_name or ".https." in test_name: |
| 242 return "https://127.0.0.1:8443/" + relative_path | 243 return "https://127.0.0.1:8443/" + relative_path |
| 243 return "http://127.0.0.1:8000/" + relative_path | 244 return "http://127.0.0.1:8000/" + relative_path |
| 244 | 245 |
| 245 def uri_to_test(self, uri): | 246 def uri_to_test(self, uri): |
| 246 """Return the base layout test name for a given URI. | 247 """Return the base layout test name for a given URI. |
| 247 | 248 |
| 248 This returns the test name for a given URI, e.g., if you passed in | 249 This returns the test name for a given URI, e.g., if you passed in |
| 249 "file:///src/LayoutTests/fast/html/keygen.html" it would return | 250 "file:///src/LayoutTests/fast/html/keygen.html" it would return |
| 250 "fast/html/keygen.html". | 251 "fast/html/keygen.html". |
| 251 | 252 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 self.decoded_content = None | 516 self.decoded_content = None |
| 516 self.malloc = None | 517 self.malloc = None |
| 517 self.js_heap = None | 518 self.js_heap = None |
| 518 self.stdin_path = None | 519 self.stdin_path = None |
| 519 | 520 |
| 520 def decode_content(self): | 521 def decode_content(self): |
| 521 if self.encoding == 'base64' and self.content is not None: | 522 if self.encoding == 'base64' and self.content is not None: |
| 522 self.decoded_content = base64.b64decode(self.content) | 523 self.decoded_content = base64.b64decode(self.content) |
| 523 else: | 524 else: |
| 524 self.decoded_content = self.content | 525 self.decoded_content = self.content |
| OLD | NEW |