OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Runs a monkey test on a single device.""" | 5 """Runs a monkey test on a single device.""" |
6 | 6 |
7 import random | 7 import random |
8 | 8 |
9 from pylib.base import base_test_result | 9 from pylib.base import base_test_result |
10 from pylib.base import base_test_runner | 10 from pylib.base import base_test_runner |
11 | 11 |
12 | 12 |
13 class TestRunner(base_test_runner.BaseTestRunner): | 13 class TestRunner(base_test_runner.BaseTestRunner): |
14 """A TestRunner instance runs a monkey test on a single device.""" | 14 """A TestRunner instance runs a monkey test on a single device.""" |
15 | 15 |
16 def __init__(self, test_options, device, shard_index): | 16 def __init__(self, test_options, device, shard_index): |
17 super(TestRunner, self).__init__(device, None, test_options.build_type) | 17 super(TestRunner, self).__init__(device, None) |
18 self.options = test_options | 18 self.options = test_options |
19 | 19 |
20 def _LaunchMonkeyTest(self): | 20 def _LaunchMonkeyTest(self): |
21 """Runs monkey test for a given package. | 21 """Runs monkey test for a given package. |
22 | 22 |
23 Returns: | 23 Returns: |
24 Output from the monkey command on the device. | 24 Output from the monkey command on the device. |
25 """ | 25 """ |
26 | 26 |
27 timeout_ms = self.options.event_count * self.options.throttle * 1.5 | 27 timeout_ms = self.options.event_count * self.options.throttle * 1.5 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 results = base_test_result.TestRunResults() | 69 results = base_test_result.TestRunResults() |
70 if 'Monkey finished' in output and not crashed: | 70 if 'Monkey finished' in output and not crashed: |
71 result = base_test_result.BaseTestResult( | 71 result = base_test_result.BaseTestResult( |
72 test_name, base_test_result.ResultType.PASS, log=output) | 72 test_name, base_test_result.ResultType.PASS, log=output) |
73 else: | 73 else: |
74 result = base_test_result.BaseTestResult( | 74 result = base_test_result.BaseTestResult( |
75 test_name, base_test_result.ResultType.FAIL, log=output) | 75 test_name, base_test_result.ResultType.FAIL, log=output) |
76 results.AddResult(result) | 76 results.AddResult(result) |
77 return results, False | 77 return results, False |
OLD | NEW |