| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 # | 5 # |
| 6 # Most of this file was ported over from Blink's | 6 # Most of this file was ported over from Blink's |
| 7 # Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py | 7 # Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py |
| 8 # Tools/Scripts/webkitpy/common/net/file_uploader.py | 8 # Tools/Scripts/webkitpy/common/net/file_uploader.py |
| 9 # | 9 # |
| 10 | 10 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 TESTS = 'tests' | 150 TESTS = 'tests' |
| 151 | 151 |
| 152 FIXABLE_COUNT = 'fixableCount' | 152 FIXABLE_COUNT = 'fixableCount' |
| 153 FIXABLE = 'fixableCounts' | 153 FIXABLE = 'fixableCounts' |
| 154 ALL_FIXABLE_COUNT = 'allFixableCount' | 154 ALL_FIXABLE_COUNT = 'allFixableCount' |
| 155 | 155 |
| 156 RESULTS_FILENAME = 'results.json' | 156 RESULTS_FILENAME = 'results.json' |
| 157 TIMES_MS_FILENAME = 'times_ms.json' | 157 TIMES_MS_FILENAME = 'times_ms.json' |
| 158 INCREMENTAL_RESULTS_FILENAME = 'incremental_results.json' | 158 INCREMENTAL_RESULTS_FILENAME = 'incremental_results.json' |
| 159 | 159 |
| 160 # line too long pylint: disable=C0301 | 160 # line too long pylint: disable=line-too-long |
| 161 URL_FOR_TEST_LIST_JSON = ( | 161 URL_FOR_TEST_LIST_JSON = ( |
| 162 'http://%s/testfile?builder=%s&name=%s&testlistjson=1&testtype=%s&master=%
s') | 162 'http://%s/testfile?builder=%s&name=%s&testlistjson=1&testtype=%s&master=%
s') |
| 163 # pylint: enable=C0301 | 163 # pylint: enable=line-too-long |
| 164 | 164 |
| 165 def __init__(self, builder_name, build_name, build_number, | 165 def __init__(self, builder_name, build_name, build_number, |
| 166 results_file_base_path, builder_base_url, | 166 results_file_base_path, builder_base_url, |
| 167 test_results_map, svn_repositories=None, | 167 test_results_map, svn_repositories=None, |
| 168 test_results_server=None, | 168 test_results_server=None, |
| 169 test_type='', | 169 test_type='', |
| 170 master_name=''): | 170 master_name=''): |
| 171 """Modifies the results.json file. Grabs it off the archive directory | 171 """Modifies the results.json file. Grabs it off the archive directory |
| 172 if it is not found locally. | 172 if it is not found locally. |
| 173 | 173 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 urllib2.quote(self._test_type), | 380 urllib2.quote(self._test_type), |
| 381 urllib2.quote(self._master_name))) | 381 urllib2.quote(self._master_name))) |
| 382 | 382 |
| 383 try: | 383 try: |
| 384 # FIXME: We should talk to the network via a Host object. | 384 # FIXME: We should talk to the network via a Host object. |
| 385 results_file = urllib2.urlopen(results_file_url) | 385 results_file = urllib2.urlopen(results_file_url) |
| 386 old_results = results_file.read() | 386 old_results = results_file.read() |
| 387 except urllib2.HTTPError, http_error: | 387 except urllib2.HTTPError, http_error: |
| 388 # A non-4xx status code means the bot is hosed for some reason | 388 # A non-4xx status code means the bot is hosed for some reason |
| 389 # and we can't grab the results.json file off of it. | 389 # and we can't grab the results.json file off of it. |
| 390 if (http_error.code < 400 and http_error.code >= 500): | 390 if http_error.code < 400 and http_error.code >= 500: |
| 391 error = http_error | 391 error = http_error |
| 392 except urllib2.URLError, url_error: | 392 except urllib2.URLError, url_error: |
| 393 error = url_error | 393 error = url_error |
| 394 | 394 |
| 395 if old_results: | 395 if old_results: |
| 396 # Strip the prefix and suffix so we can get the actual JSON object. | 396 # Strip the prefix and suffix so we can get the actual JSON object. |
| 397 old_results = StripJSONWrapper(old_results) | 397 old_results = StripJSONWrapper(old_results) |
| 398 | 398 |
| 399 try: | 399 try: |
| 400 results_json = json.loads(old_results) | 400 results_json = json.loads(old_results) |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 lines.append('') | 688 lines.append('') |
| 689 if isinstance(value, unicode): | 689 if isinstance(value, unicode): |
| 690 value = value.encode('utf-8') | 690 value = value.encode('utf-8') |
| 691 lines.append(value) | 691 lines.append(value) |
| 692 | 692 |
| 693 lines.append('--' + BOUNDARY + '--') | 693 lines.append('--' + BOUNDARY + '--') |
| 694 lines.append('') | 694 lines.append('') |
| 695 body = CRLF.join(lines) | 695 body = CRLF.join(lines) |
| 696 content_type = 'multipart/form-data; boundary=%s' % BOUNDARY | 696 content_type = 'multipart/form-data; boundary=%s' % BOUNDARY |
| 697 return content_type, body | 697 return content_type, body |
| OLD | NEW |