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 | |
56 def testRunBenchmarkListJSONListsOutBenchmarks(self): | 51 def testRunBenchmarkListJSONListsOutBenchmarks(self): |
57 tmp_file = tempfile.NamedTemporaryFile(delete=False) | 52 tmp_file = tempfile.NamedTemporaryFile(delete=False) |
58 tmp_file_name = tmp_file.name | 53 tmp_file_name = tmp_file.name |
59 tmp_file.close() | 54 tmp_file.close() |
60 try: | 55 try: |
61 return_code, _ = self.RunPerfScript( | 56 return_code, _ = self.RunPerfScript( |
62 'run_benchmark list --json-output %s' % tmp_file_name) | 57 'run_benchmark list --json-output %s' % tmp_file_name) |
63 self.assertEquals(return_code, 0) | 58 self.assertEquals(return_code, 0) |
64 with open(tmp_file_name, 'r') as f: | 59 with open(tmp_file_name, 'r') as f: |
65 benchmark_data = json.load(f) | 60 benchmark_data = json.load(f) |
66 self.assertIn('dummy_benchmark.stable_benchmark_1', | 61 self.assertIn('dummy_benchmark.stable_benchmark_1', |
67 benchmark_data['steps']) | 62 benchmark_data['steps']) |
68 finally: | 63 finally: |
69 os.remove(tmp_file_name) | 64 os.remove(tmp_file_name) |
OLD | NEW |