| 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 unexpected_result_count = runner.run() | 483 unexpected_result_count = runner.run() |
| 484 finally: | 484 finally: |
| 485 stdout, stderr, log = output.restore_output() | 485 stdout, stderr, log = output.restore_output() |
| 486 self.assertEqual(unexpected_result_count, 0) | 486 self.assertEqual(unexpected_result_count, 0) |
| 487 self.assertEqual(self._normalize_output(log), MemoryTestData.output + '\
nMOCK: user.open_url: file://...\n') | 487 self.assertEqual(self._normalize_output(log), MemoryTestData.output + '\
nMOCK: user.open_url: file://...\n') |
| 488 parser_tests = self._load_output_json(runner)[0]['tests']['Parser']['tes
ts'] | 488 parser_tests = self._load_output_json(runner)[0]['tests']['Parser']['tes
ts'] |
| 489 self.assertEqual(parser_tests['memory-test']['metrics']['Time'], MemoryT
estData.results) | 489 self.assertEqual(parser_tests['memory-test']['metrics']['Time'], MemoryT
estData.results) |
| 490 self.assertEqual(parser_tests['memory-test']['metrics']['JSHeap'], Memor
yTestData.js_heap_results) | 490 self.assertEqual(parser_tests['memory-test']['metrics']['JSHeap'], Memor
yTestData.js_heap_results) |
| 491 self.assertEqual(parser_tests['memory-test']['metrics']['Malloc'], Memor
yTestData.malloc_results) | 491 self.assertEqual(parser_tests['memory-test']['metrics']['Malloc'], Memor
yTestData.malloc_results) |
| 492 | 492 |
| 493 def _test_run_with_json_output(self, runner, filesystem, upload_succeeds=Fal
se, results_shown=True, expected_exit_code=0, repeat=1, compare_logs=True): | 493 def _test_run_with_json_output( |
| 494 self, runner, filesystem, upload_succeeds=False, results_shown=True,
expected_exit_code=0, repeat=1, compare_logs=True): |
| 494 filesystem.write_text_file(runner._base_path + '/inspector/pass.html', '
some content') | 495 filesystem.write_text_file(runner._base_path + '/inspector/pass.html', '
some content') |
| 495 filesystem.write_text_file(runner._base_path + '/Bindings/event-target-w
rapper.html', 'some content') | 496 filesystem.write_text_file(runner._base_path + '/Bindings/event-target-w
rapper.html', 'some content') |
| 496 | 497 |
| 497 uploaded = [False] | 498 uploaded = [False] |
| 498 | 499 |
| 499 def mock_upload_json(hostname, json_path, host_path=None): | 500 def mock_upload_json(hostname, json_path, host_path=None): |
| 500 # FIXME: Get rid of the hard-coded perf.webkit.org once we've comple
ted the transition. | 501 # FIXME: Get rid of the hard-coded perf.webkit.org once we've comple
ted the transition. |
| 501 self.assertIn(hostname, ['some.host']) | 502 self.assertIn(hostname, ['some.host']) |
| 502 self.assertIn(json_path, ['/mock-checkout/output.json']) | 503 self.assertIn(json_path, ['/mock-checkout/output.json']) |
| 503 self.assertIn(host_path, [None, '/api/report']) | 504 self.assertIn(host_path, [None, '/api/report']) |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 self._test_run_with_json_output(runner, port.host.filesystem, compare_lo
gs=False) | 772 self._test_run_with_json_output(runner, port.host.filesystem, compare_lo
gs=False) |
| 772 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) | 773 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) |
| 773 self.assertTrue(isinstance(generated_json, list)) | 774 self.assertTrue(isinstance(generated_json, list)) |
| 774 self.assertEqual(len(generated_json), 1) | 775 self.assertEqual(len(generated_json), 1) |
| 775 | 776 |
| 776 output = generated_json[0]['tests']['Bindings']['tests']['event-target-w
rapper']['metrics']['Time']['current'] | 777 output = generated_json[0]['tests']['Bindings']['tests']['event-target-w
rapper']['metrics']['Time']['current'] |
| 777 self.assertEqual(len(output), 3) | 778 self.assertEqual(len(output), 3) |
| 778 expectedMetrics = EventTargetWrapperTestData.results['metrics']['Time'][
'current'][0] | 779 expectedMetrics = EventTargetWrapperTestData.results['metrics']['Time'][
'current'][0] |
| 779 for metrics in output: | 780 for metrics in output: |
| 780 self.assertEqual(metrics, expectedMetrics) | 781 self.assertEqual(metrics, expectedMetrics) |
| OLD | NEW |