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