OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import json | 5 import json |
6 import os | 6 import os |
7 import subprocess | 7 import subprocess |
8 import sys | 8 import sys |
9 import tempfile | 9 import tempfile |
10 import unittest | 10 import unittest |
(...skipping 30 matching lines...) Expand all Loading... |
41 return_code, stdout = self.RunPerfScript('run_benchmark list') | 41 return_code, stdout = self.RunPerfScript('run_benchmark list') |
42 self.assertIn('Pass --browser to list benchmarks', stdout) | 42 self.assertIn('Pass --browser to list benchmarks', stdout) |
43 self.assertIn('dummy_benchmark.stable_benchmark_1', stdout) | 43 self.assertIn('dummy_benchmark.stable_benchmark_1', stdout) |
44 self.assertEquals(return_code, 0) | 44 self.assertEquals(return_code, 0) |
45 | 45 |
46 def testRunRecordWprHelp(self): | 46 def testRunRecordWprHelp(self): |
47 return_code, stdout = self.RunPerfScript('record_wpr') | 47 return_code, stdout = self.RunPerfScript('record_wpr') |
48 self.assertIn('optional arguments:', stdout) | 48 self.assertIn('optional arguments:', stdout) |
49 self.assertEquals(return_code, 0) | 49 self.assertEquals(return_code, 0) |
50 | 50 |
| 51 def testRunRecordWprList(self): |
| 52 return_code, stdout = self.RunPerfScript('record_wpr --list-benchmarks') |
| 53 self.assertIn('kraken', stdout) |
| 54 self.assertEquals(return_code, 0) |
| 55 |
51 def testRunBenchmarkListJSONListsOutBenchmarks(self): | 56 def testRunBenchmarkListJSONListsOutBenchmarks(self): |
52 tmp_file = tempfile.NamedTemporaryFile(delete=False) | 57 tmp_file = tempfile.NamedTemporaryFile(delete=False) |
53 tmp_file_name = tmp_file.name | 58 tmp_file_name = tmp_file.name |
54 tmp_file.close() | 59 tmp_file.close() |
55 try: | 60 try: |
56 return_code, _ = self.RunPerfScript( | 61 return_code, _ = self.RunPerfScript( |
57 'run_benchmark list --json-output %s' % tmp_file_name) | 62 'run_benchmark list --json-output %s' % tmp_file_name) |
58 self.assertEquals(return_code, 0) | 63 self.assertEquals(return_code, 0) |
59 with open(tmp_file_name, 'r') as f: | 64 with open(tmp_file_name, 'r') as f: |
60 benchmark_data = json.load(f) | 65 benchmark_data = json.load(f) |
61 self.assertIn('dummy_benchmark.stable_benchmark_1', | 66 self.assertIn('dummy_benchmark.stable_benchmark_1', |
62 benchmark_data['steps']) | 67 benchmark_data['steps']) |
63 finally: | 68 finally: |
64 os.remove(tmp_file_name) | 69 os.remove(tmp_file_name) |
OLD | NEW |