Changeset 100862 in webkit


Ignore:
Timestamp:
Nov 19, 2011 5:13:19 PM (12 years ago)
Author:
ojan@chromium.org
Message:

Remove the dependence on jsonp from more of new-run-webkit-tests and the test results server
https://bugs.webkit.org/show_bug.cgi?id=72813

Reviewed by Adam Barth.

Once this lands, we can start storing pure json in the test results server and then
we can delete the code with all the FIXMEs added here.

  • Scripts/webkitpy/layout_tests/controllers/manager.py:
  • Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:

Only add jsonp for full_results.json.

  • TestResultServer/model/jsonresults.py:
  • TestResultServer/model/jsonresults_unittest.py:

Accept pure json uploads.

  • TestResultServer/static-dashboards/dashboard_base.js:

(appendJSONScriptElementFor):
Use the callback parameter so that the server can start returning pure json if it's left out.

Location:
trunk/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r100861 r100862  
     12011-11-19  Ojan Vafai  <ojan@chromium.org>
     2
     3        Remove the dependence on jsonp from more of new-run-webkit-tests and the test results server
     4        https://bugs.webkit.org/show_bug.cgi?id=72813
     5
     6        Reviewed by Adam Barth.
     7
     8        Once this lands, we can start storing pure json in the test results server and then
     9        we can delete the code with all the FIXMEs added here.
     10
     11        * Scripts/webkitpy/layout_tests/controllers/manager.py:
     12        * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
     13        Only add jsonp for full_results.json.
     14        * TestResultServer/model/jsonresults.py:
     15        * TestResultServer/model/jsonresults_unittest.py:
     16        Accept pure json uploads.
     17        * TestResultServer/static-dashboards/dashboard_base.js:
     18        (appendJSONScriptElementFor):
     19        Use the callback parameter so that the server can start returning pure json if it's left out.
     20
    1212011-11-19  Ojan Vafai  <ojan@chromium.org>
    222
  • trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py

    r100558 r100862  
    10821082
    10831083        full_results_path = self._fs.join(self._results_directory, "full_results.json")
    1084         json_results_generator.write_json(self._fs, summarized_results, full_results_path)
     1084        # We write full_results.json out as jsonp because we need to load it from a file url and Chromium doesn't allow that.
     1085        json_results_generator.write_json(self._fs, summarized_results, full_results_path, callback="ADD_RESULTS")
    10851086
    10861087        generator = json_layout_results_generator.JSONLayoutResultsGenerator(
  • trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py

    r100861 r100862  
    5757
    5858def strip_json_wrapper(json_content):
     59    # FIXME: Kill this code once the server returns json instead of jsonp.
    5960    if has_json_wrapper(json_content):
    6061        return json_content[len(_JSON_PREFIX):len(json_content) - len(_JSON_SUFFIX)]
     
    6869
    6970
    70 def write_json(filesystem, json_object, file_path):
     71def write_json(filesystem, json_object, file_path, callback=None):
    7172    # Specify separators in order to get compact encoding.
    72     json_data = json.dumps(json_object, separators=(',', ':'))
    73     json_string = _JSON_PREFIX + json_data + _JSON_SUFFIX
     73    json_string = json.dumps(json_object, separators=(',', ':'))
     74    if callback:
     75        json_string = callback + "(" + json_string + ");"
    7476    filesystem.write_text_file(file_path, json_string)
    7577
  • trunk/Tools/TestResultServer/model/jsonresults.py

    r99783 r100862  
    5454    @classmethod
    5555    def _strip_prefix_suffix(cls, data):
    56         assert(data.startswith(JSON_RESULTS_PREFIX))
    57         assert(data.endswith(JSON_RESULTS_SUFFIX))
    58 
    59         return data[len(JSON_RESULTS_PREFIX):len(data) - len(JSON_RESULTS_SUFFIX)]
     56        # FIXME: Stop stripping jsonp callback once we upload pure json everywhere.
     57        if data.startswith(JSON_RESULTS_PREFIX) and data.endswith(JSON_RESULTS_SUFFIX):
     58            return data[len(JSON_RESULTS_PREFIX):len(data) - len(JSON_RESULTS_SUFFIX)]
     59        return data
    6060
    6161    @classmethod
  • trunk/Tools/TestResultServer/model/jsonresults_unittest.py

    r99783 r100862  
    8282        self._builder = "Webkit"
    8383
     84    def test_strip_prefix_suffix(self):
     85        json = "['contents']"
     86        self.assertEqual(JsonResults._strip_prefix_suffix(JSON_RESULTS_PREFIX + json + JSON_RESULTS_SUFFIX), json)
     87        self.assertEqual(JsonResults._strip_prefix_suffix(json), json)
     88
    8489    def _make_test_json(self, test_data):
    8590        if not test_data:
  • trunk/Tools/TestResultServer/static-dashboards/dashboard_base.js

    r91713 r100862  
    527527        resultsFilename = 'results-small.json';
    528528
    529     appendScript(pathToBuilderResultsFile(builderName) + resultsFilename,
     529    appendScript(pathToBuilderResultsFile(builderName) + resultsFilename + '&callback=ADD_RESULTS',
    530530            partial(handleResourceLoadError, builderName),
    531531            partial(handleScriptLoaded, builderName));
Note: See TracChangeset for help on using the changeset viewer.