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 """Base class for host-driven test cases. | 5 """Base class for host-driven test cases. |
6 | 6 |
7 This test case is intended to serve as the base class for any host-driven | 7 This test case is intended to serve as the base class for any host-driven |
8 test cases. It is similar to the Python unitttest module in that test cases | 8 test cases. It is similar to the Python unitttest module in that test cases |
9 inherit from this class and add methods which will be run as tests. | 9 inherit from this class and add methods which will be run as tests. |
10 | 10 |
11 When a HostDrivenTestCase object is instantiated, its purpose is to run only one | 11 When a HostDrivenTestCase object is instantiated, its purpose is to run only one |
12 test method in the derived class. The test runner gives it the name of the test | 12 test method in the derived class. The test runner gives it the name of the test |
13 method the instance will run. The test runner calls SetUp with the device ID | 13 method the instance will run. The test runner calls SetUp with the device ID |
14 which the test method will run against. The test runner runs the test method | 14 which the test method will run against. The test runner runs the test method |
15 itself, collecting the result, and calls TearDown. | 15 itself, collecting the result, and calls TearDown. |
16 | 16 |
17 Tests can perform arbitrary Python commands and asserts in test methods. Tests | 17 Tests can perform arbitrary Python commands and asserts in test methods. Tests |
18 that run instrumentation tests can make use of the _RunJavaTestFilters helper | 18 that run instrumentation tests can make use of the _RunJavaTestFilters helper |
19 function to trigger Java tests and convert results into a single host-driven | 19 function to trigger Java tests and convert results into a single host-driven |
20 test result. | 20 test result. |
21 """ | 21 """ |
22 | 22 |
23 import logging | 23 import logging |
24 import os | 24 import os |
25 import time | 25 import time |
26 | 26 |
27 from devil.android import device_utils | |
28 from pylib import constants | 27 from pylib import constants |
29 from pylib import forwarder | 28 from pylib import forwarder |
30 from pylib import valgrind_tools | 29 from pylib import valgrind_tools |
31 from pylib.base import base_test_result | 30 from pylib.base import base_test_result |
32 from pylib.instrumentation import test_package | 31 from pylib.instrumentation import test_package |
33 from pylib.instrumentation import test_result | 32 from pylib.instrumentation import test_result |
34 from pylib.instrumentation import test_runner | 33 from pylib.instrumentation import test_runner |
35 | 34 |
36 # aka the parent of com.google.android | 35 # aka the parent of com.google.android |
37 BASE_ROOT = 'src' + os.sep | 36 BASE_ROOT = 'src' + os.sep |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 overall_result.AddResult( | 180 overall_result.AddResult( |
182 test_result.InstrumentationTestResult( | 181 test_result.InstrumentationTestResult( |
183 self.tagged_name, test_type, start_ms, duration_ms, log=log)) | 182 self.tagged_name, test_type, start_ms, duration_ms, log=log)) |
184 return overall_result | 183 return overall_result |
185 | 184 |
186 def __str__(self): | 185 def __str__(self): |
187 return self.tagged_name | 186 return self.tagged_name |
188 | 187 |
189 def __repr__(self): | 188 def __repr__(self): |
190 return self.tagged_name | 189 return self.tagged_name |
OLD | NEW |