| OLD | NEW |
| 1 # Copyright (C) 2012 Google Inc. All rights reserved. | 1 # Copyright (C) 2012 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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 output_json_path = runner._output_json_path() | 606 output_json_path = runner._output_json_path() |
| 607 | 607 |
| 608 filesystem.write_text_file(output_json_path, '[{"previous": "results"}]'
) | 608 filesystem.write_text_file(output_json_path, '[{"previous": "results"}]'
) |
| 609 | 609 |
| 610 self._test_run_with_json_output(runner, port.host.filesystem) | 610 self._test_run_with_json_output(runner, port.host.filesystem) |
| 611 | 611 |
| 612 self.assertEqual(self._load_output_json(runner), [{ | 612 self.assertEqual(self._load_output_json(runner), [{ |
| 613 "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_targ
et_wrapper_and_inspector_results, | 613 "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_targ
et_wrapper_and_inspector_results, |
| 614 "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000",
"revision": "5678"}}}]) | 614 "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000",
"revision": "5678"}}}]) |
| 615 self.assertTrue(filesystem.isfile(filesystem.splitext(output_json_path)[
0] + '.html')) | 615 self.assertTrue(filesystem.isfile(filesystem.splitext(output_json_path)[
0] + '.html')) |
| 616 pass | |
| 617 | 616 |
| 618 def test_run_generates_and_show_results_page(self): | 617 def test_run_generates_and_show_results_page(self): |
| 619 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json']) | 618 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json']) |
| 620 page_shown = [] | 619 page_shown = [] |
| 621 port.show_results_html_file = lambda path: page_shown.append(path) | 620 port.show_results_html_file = lambda path: page_shown.append(path) |
| 622 filesystem = port.host.filesystem | 621 filesystem = port.host.filesystem |
| 623 self._test_run_with_json_output(runner, filesystem, results_shown=False) | 622 self._test_run_with_json_output(runner, filesystem, results_shown=False) |
| 624 | 623 |
| 625 expected_entry = {"buildTime": "2013-02-08T15:19:37.460000", | 624 expected_entry = {"buildTime": "2013-02-08T15:19:37.460000", |
| 626 "tests": self._event_target_wrapper_and_inspector_resu
lts, | 625 "tests": self._event_target_wrapper_and_inspector_resu
lts, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 self._test_run_with_json_output(runner, port.host.filesystem, compare_lo
gs=False) | 771 self._test_run_with_json_output(runner, port.host.filesystem, compare_lo
gs=False) |
| 773 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) | 772 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) |
| 774 self.assertTrue(isinstance(generated_json, list)) | 773 self.assertTrue(isinstance(generated_json, list)) |
| 775 self.assertEqual(len(generated_json), 1) | 774 self.assertEqual(len(generated_json), 1) |
| 776 | 775 |
| 777 output = generated_json[0]['tests']['Bindings']['tests']['event-target-w
rapper']['metrics']['Time']['current'] | 776 output = generated_json[0]['tests']['Bindings']['tests']['event-target-w
rapper']['metrics']['Time']['current'] |
| 778 self.assertEqual(len(output), 3) | 777 self.assertEqual(len(output), 3) |
| 779 expectedMetrics = EventTargetWrapperTestData.results['metrics']['Time'][
'current'][0] | 778 expectedMetrics = EventTargetWrapperTestData.results['metrics']['Time'][
'current'][0] |
| 780 for metrics in output: | 779 for metrics in output: |
| 781 self.assertEqual(metrics, expectedMetrics) | 780 self.assertEqual(metrics, expectedMetrics) |
| OLD | NEW |