| 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 # pylint: disable=R0201 |
| 7 import logging | |
| 8 | 7 |
| 9 | 8 |
| 10 class TestPackage(object): | 9 class TestPackage(object): |
| 11 | 10 |
| 12 """A helper base class for both APK and stand-alone executables. | 11 """A helper base class for both APK and stand-alone executables. |
| 13 | 12 |
| 14 Args: | 13 Args: |
| 15 suite_name: Name of the test suite (e.g. base_unittests). | 14 suite_name: Name of the test suite (e.g. base_unittests). |
| 16 """ | 15 """ |
| 17 def __init__(self, suite_name): | 16 def __init__(self, suite_name): |
| (...skipping 18 matching lines...) Expand all Loading... |
| 36 raise NotImplementedError('Method must be overriden.') | 35 raise NotImplementedError('Method must be overriden.') |
| 37 | 36 |
| 38 def GetAllTests(self, adb): | 37 def GetAllTests(self, adb): |
| 39 """Returns a list of all tests available in the test suite. | 38 """Returns a list of all tests available in the test suite. |
| 40 | 39 |
| 41 Args: | 40 Args: |
| 42 adb: Instance of AndroidCommands. | 41 adb: Instance of AndroidCommands. |
| 43 """ | 42 """ |
| 44 raise NotImplementedError('Method must be overriden.') | 43 raise NotImplementedError('Method must be overriden.') |
| 45 | 44 |
| 46 def GetGTestReturnCode(self, adb): | 45 def GetGTestReturnCode(self, _adb): |
| 47 return None | 46 return None |
| 48 | 47 |
| 49 def SpawnTestProcess(self, adb): | 48 def SpawnTestProcess(self, adb): |
| 50 """Spawn the test process. | 49 """Spawn the test process. |
| 51 | 50 |
| 52 Args: | 51 Args: |
| 53 adb: Instance of AndroidCommands. | 52 adb: Instance of AndroidCommands. |
| 54 | 53 |
| 55 Returns: | 54 Returns: |
| 56 An instance of pexpect spawn class. | 55 An instance of pexpect spawn class. |
| 57 """ | 56 """ |
| 58 raise NotImplementedError('Method must be overriden.') | 57 raise NotImplementedError('Method must be overriden.') |
| 59 | 58 |
| 60 def Install(self, adb): | 59 def Install(self, adb): |
| 61 """Install the test package to the device. | 60 """Install the test package to the device. |
| 62 | 61 |
| 63 Args: | 62 Args: |
| 64 adb: Instance of AndroidCommands. | 63 adb: Instance of AndroidCommands. |
| 65 """ | 64 """ |
| 66 raise NotImplementedError('Method must be overriden.') | 65 raise NotImplementedError('Method must be overriden.') |
| 67 | 66 |
| 68 def _ParseGTestListTests(self, raw_list): | 67 @staticmethod |
| 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 |