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 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 # Run the test. | 60 # Run the test. |
61 output = '' | 61 output = '' |
62 if before_pids: | 62 if before_pids: |
63 output = '\n'.join(self._LaunchMonkeyTest()) | 63 output = '\n'.join(self._LaunchMonkeyTest()) |
64 after_pids = self.adb.ExtractPid(self.options.package_name) | 64 after_pids = self.adb.ExtractPid(self.options.package_name) |
65 | 65 |
66 crashed = (not before_pids or not after_pids | 66 crashed = (not before_pids or not after_pids |
67 or after_pids[0] != before_pids[0]) | 67 or after_pids[0] != before_pids[0]) |
68 | 68 |
69 results = base_test_result.TestRunResults() | 69 results = base_test_result.TestRunResults() |
70 if 'Monkey finished' in output and not crashed: | 70 success_pattern = 'Events injected: %d' % self.options.event_count |
| 71 if success_pattern in output and not crashed: |
71 result = base_test_result.BaseTestResult( | 72 result = base_test_result.BaseTestResult( |
72 test_name, base_test_result.ResultType.PASS, log=output) | 73 test_name, base_test_result.ResultType.PASS, log=output) |
73 else: | 74 else: |
74 result = base_test_result.BaseTestResult( | 75 result = base_test_result.BaseTestResult( |
75 test_name, base_test_result.ResultType.FAIL, log=output) | 76 test_name, base_test_result.ResultType.FAIL, log=output) |
76 results.AddResult(result) | 77 results.AddResult(result) |
77 return results, False | 78 return results, False |
OLD | NEW |