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
3 # found in the LICENSE file.
5 """Base class representing GTest test packages."""
6 # pylint: disable=R0201
9 class TestPackage(object):
11 """A helper base class for both APK and stand-alone executables.
14 suite_name: Name of the test suite (e.g. base_unittests).
16 def __init__(self
, suite_name
):
17 self
.suite_name
= suite_name
20 def ClearApplicationState(self
, device
):
21 """Clears the application state.
24 device: Instance of DeviceUtils.
26 raise NotImplementedError('Method must be overridden.')
28 def CreateCommandLineFileOnDevice(self
, device
, test_filter
, test_arguments
):
29 """Creates a test runner script and pushes to the device.
32 device: Instance of DeviceUtils.
33 test_filter: A test_filter flag.
34 test_arguments: Additional arguments to pass to the test binary.
36 raise NotImplementedError('Method must be overridden.')
38 def GetAllTests(self
, device
):
39 """Returns a list of all tests available in the test suite.
42 device: Instance of DeviceUtils.
44 raise NotImplementedError('Method must be overridden.')
46 def GetGTestReturnCode(self
, _device
):
49 def SpawnTestProcess(self
, device
):
50 """Spawn the test process.
53 device: Instance of DeviceUtils.
56 An instance of pexpect spawn class.
58 raise NotImplementedError('Method must be overridden.')
60 def Install(self
, device
):
61 """Install the test package to the device.
64 device: Instance of DeviceUtils.
66 raise NotImplementedError('Method must be overridden.')
68 def PullAppFiles(self
, device
, files
, directory
):
69 """Pull application data from the device.
72 device: Instance of DeviceUtils.
73 files: A list of paths relative to the application data directory to
74 retrieve from the device.
75 directory: The host directory to which files should be pulled.
77 raise NotImplementedError('Method must be overridden.')