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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 max 1510 ms | 265 max 1510 ms |
266 """ | 266 """ |
267 | 267 |
268 output = """Running Bindings/event-target-wrapper.html (1 of 2) | 268 output = """Running Bindings/event-target-wrapper.html (1 of 2) |
269 RESULT Bindings: event-target-wrapper: Time= 1490.0 ms | 269 RESULT Bindings: event-target-wrapper: Time= 1490.0 ms |
270 median= 1488.0 ms, stdev= 14.11751 ms, min= 1471.0 ms, max= 1510.0 ms | 270 median= 1488.0 ms, stdev= 14.11751 ms, min= 1471.0 ms, max= 1510.0 ms |
271 Finished: 0.1 s | 271 Finished: 0.1 s |
272 | 272 |
273 """ | 273 """ |
274 | 274 |
275 results = {'url': 'https://src.chromium.org/viewvc/blink/trunk/PerformanceTe
sts/Bindings/event-target-wrapper.html', | 275 results = { |
276 'metrics': {'Time': {'current': [[1486.0, 1471.0, 1510.0, 1505.0,
1478.0, 1490.0]] * 4}}} | 276 'url': ('https://chromium.googlesource.com/chromium/src/+/master/third_p
arty/WebKit' |
| 277 '/PerformanceTests/Bindings/event-target-wrapper.html'), |
| 278 'metrics': {'Time': {'current': [[1486.0, 1471.0, 1510.0, 1505.0, 1478.0
, 1490.0]] * 4}} |
| 279 } |
277 | 280 |
278 | 281 |
279 class SomeParserTestData: | 282 class SomeParserTestData: |
280 text = """Running 20 times | 283 text = """Running 20 times |
281 Ignoring warm-up run (1115) | 284 Ignoring warm-up run (1115) |
282 | 285 |
283 Time: | 286 Time: |
284 values 1080, 1120, 1095, 1101, 1104 ms | 287 values 1080, 1120, 1095, 1101, 1104 ms |
285 avg 1100 ms | 288 avg 1100 ms |
286 median 1101 ms | 289 median 1101 ms |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 expected_logs += 'Running 2 tests%s\n' % runs + EventTargetWrapp
erTestData.output + InspectorPassTestData.output | 522 expected_logs += 'Running 2 tests%s\n' % runs + EventTargetWrapp
erTestData.output + InspectorPassTestData.output |
520 if results_shown: | 523 if results_shown: |
521 expected_logs += 'MOCK: user.open_url: file://...\n' | 524 expected_logs += 'MOCK: user.open_url: file://...\n' |
522 self.assertEqual(self._normalize_output(logs), expected_logs) | 525 self.assertEqual(self._normalize_output(logs), expected_logs) |
523 | 526 |
524 self.assertEqual(uploaded[0], upload_succeeds) | 527 self.assertEqual(uploaded[0], upload_succeeds) |
525 | 528 |
526 return logs | 529 return logs |
527 | 530 |
528 _event_target_wrapper_and_inspector_results = { | 531 _event_target_wrapper_and_inspector_results = { |
529 "Bindings": | 532 "Bindings": { |
530 {"url": "https://src.chromium.org/viewvc/blink/trunk/PerformanceTest
s/Bindings", | 533 "url": "https://chromium.googlesource.com/chromium/src/+/master/thir
d_party/WebKit/PerformanceTests/Bindings", |
531 "tests": {"event-target-wrapper": EventTargetWrapperTestData.result
s}}} | 534 "tests": {"event-target-wrapper": EventTargetWrapperTestData.results
} |
| 535 } |
| 536 } |
532 | 537 |
533 def test_run_with_json_output(self): | 538 def test_run_with_json_output(self): |
534 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', | 539 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', |
535 '--te
st-results-server=some.host']) | 540 '--te
st-results-server=some.host']) |
536 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True) | 541 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True) |
537 self.assertEqual(self._load_output_json(runner), [{ | 542 self.assertEqual(self._load_output_json(runner), [{ |
538 "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_targ
et_wrapper_and_inspector_results, | 543 "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_targ
et_wrapper_and_inspector_results, |
539 "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000",
"revision": "5678"}}}]) | 544 "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000",
"revision": "5678"}}}]) |
540 | 545 |
541 filesystem = port.host.filesystem | 546 filesystem = port.host.filesystem |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 self.maxDiff = None | 733 self.maxDiff = None |
729 self.assertEqual(output['platform'], 'platform1') | 734 self.assertEqual(output['platform'], 'platform1') |
730 self.assertEqual(output['buildNumber'], 123) | 735 self.assertEqual(output['buildNumber'], 123) |
731 self.assertEqual(output['buildTime'], '2013-02-08T15:19:37.460000') | 736 self.assertEqual(output['buildTime'], '2013-02-08T15:19:37.460000') |
732 self.assertEqual(output['builderName'], 'builder1') | 737 self.assertEqual(output['builderName'], 'builder1') |
733 self.assertEqual(output['builderKey'], 'value1') | 738 self.assertEqual(output['builderKey'], 'value1') |
734 self.assertEqual(output['revisions'], {'chromium': {'revision': '5678',
'timestamp': '2013-02-01 08:48:05 +0000'}}) | 739 self.assertEqual(output['revisions'], {'chromium': {'revision': '5678',
'timestamp': '2013-02-01 08:48:05 +0000'}}) |
735 self.assertEqual(output['tests'].keys(), ['Bindings']) | 740 self.assertEqual(output['tests'].keys(), ['Bindings']) |
736 self.assertEqual(sorted(output['tests']['Bindings'].keys()), ['tests', '
url']) | 741 self.assertEqual(sorted(output['tests']['Bindings'].keys()), ['tests', '
url']) |
737 self.assertEqual(output['tests']['Bindings']['url'], | 742 self.assertEqual(output['tests']['Bindings']['url'], |
738 'https://src.chromium.org/viewvc/blink/trunk/Performanc
eTests/Bindings') | 743 'https://chromium.googlesource.com/chromium/src/+/maste
r/third_party/WebKit/PerformanceTests/Bindings') |
739 self.assertEqual(output['tests']['Bindings']['tests'].keys(), ['event-ta
rget-wrapper']) | 744 self.assertEqual(output['tests']['Bindings']['tests'].keys(), ['event-ta
rget-wrapper']) |
740 self.assertEqual(output['tests']['Bindings']['tests']['event-target-wrap
per'], { | 745 self.assertEqual(output['tests']['Bindings']['tests']['event-target-wrap
per'], { |
741 'url': 'https://src.chromium.org/viewvc/blink/trunk/PerformanceTests
/Bindings/event-target-wrapper.html', | 746 'url': ('https://chromium.googlesource.com/chromium/src/+/master/thi
rd_party/WebKit' |
742 'metrics': {'Time': {'current': [[1486.0, 1471.0, 1510.0, 1505.0, 14
78.0, 1490.0]] * 4}}}) | 747 '/PerformanceTests/Bindings/event-target-wrapper.html'), |
| 748 'metrics': {'Time': {'current': [[1486.0, 1471.0, 1510.0, 1505.0, 14
78.0, 1490.0]] * 4}} |
| 749 }) |
743 | 750 |
744 def test_run_with_repeat(self): | 751 def test_run_with_repeat(self): |
745 self.maxDiff = None | 752 self.maxDiff = None |
746 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', | 753 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', |
747 '--te
st-results-server=some.host', '--repeat', '5']) | 754 '--te
st-results-server=some.host', '--repeat', '5']) |
748 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True, repeat=5) | 755 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True, repeat=5) |
749 self.assertEqual(self._load_output_json(runner), [ | 756 self.assertEqual(self._load_output_json(runner), [ |
750 {"buildTime": "2013-02-08T15:19:37.460000", | 757 {"buildTime": "2013-02-08T15:19:37.460000", |
751 "tests": self._event_target_wrapper_and_inspector_results, | 758 "tests": self._event_target_wrapper_and_inspector_results, |
752 "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000"
, "revision": "5678"}}}, | 759 "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000"
, "revision": "5678"}}}, |
(...skipping 16 matching lines...) Expand all Loading... |
769 self._test_run_with_json_output(runner, port.host.filesystem, compare_lo
gs=False) | 776 self._test_run_with_json_output(runner, port.host.filesystem, compare_lo
gs=False) |
770 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) | 777 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) |
771 self.assertTrue(isinstance(generated_json, list)) | 778 self.assertTrue(isinstance(generated_json, list)) |
772 self.assertEqual(len(generated_json), 1) | 779 self.assertEqual(len(generated_json), 1) |
773 | 780 |
774 output = generated_json[0]['tests']['Bindings']['tests']['event-target-w
rapper']['metrics']['Time']['current'] | 781 output = generated_json[0]['tests']['Bindings']['tests']['event-target-w
rapper']['metrics']['Time']['current'] |
775 self.assertEqual(len(output), 3) | 782 self.assertEqual(len(output), 3) |
776 expectedMetrics = EventTargetWrapperTestData.results['metrics']['Time'][
'current'][0] | 783 expectedMetrics = EventTargetWrapperTestData.results['metrics']['Time'][
'current'][0] |
777 for metrics in output: | 784 for metrics in output: |
778 self.assertEqual(metrics, expectedMetrics) | 785 self.assertEqual(metrics, expectedMetrics) |
OLD | NEW |