OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 representing GTest test packages.""" | 5 """Base class representing GTest test packages.""" |
6 | 6 |
7 import logging | |
8 | |
9 | 7 |
10 class TestPackage(object): | 8 class TestPackage(object): |
11 | 9 |
12 """A helper base class for both APK and stand-alone executables. | 10 """A helper base class for both APK and stand-alone executables. |
13 | 11 |
14 Args: | 12 Args: |
15 suite_name: Name of the test suite (e.g. base_unittests). | 13 suite_name: Name of the test suite (e.g. base_unittests). |
16 """ | 14 """ |
17 def __init__(self, suite_name): | 15 def __init__(self, suite_name): |
18 self.suite_name = suite_name | 16 self.suite_name = suite_name |
(...skipping 17 matching lines...) Expand all Loading... |
36 raise NotImplementedError('Method must be overriden.') | 34 raise NotImplementedError('Method must be overriden.') |
37 | 35 |
38 def GetAllTests(self, adb): | 36 def GetAllTests(self, adb): |
39 """Returns a list of all tests available in the test suite. | 37 """Returns a list of all tests available in the test suite. |
40 | 38 |
41 Args: | 39 Args: |
42 adb: Instance of AndroidCommands. | 40 adb: Instance of AndroidCommands. |
43 """ | 41 """ |
44 raise NotImplementedError('Method must be overriden.') | 42 raise NotImplementedError('Method must be overriden.') |
45 | 43 |
46 def GetGTestReturnCode(self, adb): | 44 def GetGTestReturnCode(self, _adb): |
47 return None | 45 return None |
48 | 46 |
49 def SpawnTestProcess(self, adb): | 47 def SpawnTestProcess(self, adb): |
50 """Spawn the test process. | 48 """Spawn the test process. |
51 | 49 |
52 Args: | 50 Args: |
53 adb: Instance of AndroidCommands. | 51 adb: Instance of AndroidCommands. |
54 | 52 |
55 Returns: | 53 Returns: |
56 An instance of pexpect spawn class. | 54 An instance of pexpect spawn class. |
57 """ | 55 """ |
58 raise NotImplementedError('Method must be overriden.') | 56 raise NotImplementedError('Method must be overriden.') |
59 | 57 |
60 def Install(self, adb): | 58 def Install(self, adb): |
61 """Install the test package to the device. | 59 """Install the test package to the device. |
62 | 60 |
63 Args: | 61 Args: |
64 adb: Instance of AndroidCommands. | 62 adb: Instance of AndroidCommands. |
65 """ | 63 """ |
66 raise NotImplementedError('Method must be overriden.') | 64 raise NotImplementedError('Method must be overriden.') |
67 | 65 |
68 def _ParseGTestListTests(self, raw_list): | 66 @staticmethod |
| 67 def _ParseGTestListTests(raw_list): |
69 """Parses a raw test list as provided by --gtest_list_tests. | 68 """Parses a raw test list as provided by --gtest_list_tests. |
70 | 69 |
71 Args: | 70 Args: |
72 raw_list: The raw test listing with the following format: | 71 raw_list: The raw test listing with the following format: |
73 | 72 |
74 IPCChannelTest. | 73 IPCChannelTest. |
75 SendMessageInChannelConnected | 74 SendMessageInChannelConnected |
76 IPCSyncChannelTest. | 75 IPCSyncChannelTest. |
77 Simple | 76 Simple |
78 DISABLED_SendWithTimeoutMixedOKAndTimeout | 77 DISABLED_SendWithTimeoutMixedOKAndTimeout |
(...skipping 13 matching lines...) Expand all Loading... |
92 # Ignore any lines with unexpected format. | 91 # Ignore any lines with unexpected format. |
93 continue | 92 continue |
94 if test[0] != ' ' and test.endswith('.'): | 93 if test[0] != ' ' and test.endswith('.'): |
95 current = test | 94 current = test |
96 continue | 95 continue |
97 if 'YOU HAVE' in test: | 96 if 'YOU HAVE' in test: |
98 break | 97 break |
99 test_name = test[2:] | 98 test_name = test[2:] |
100 ret += [current + test_name] | 99 ret += [current + test_name] |
101 return ret | 100 return ret |
OLD | NEW |