Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: build/android/pylib/base/base_test_runner.py

Issue 1116493003: Revert of [Android] Remove more uses of android_commands from build/android/pylib. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/PRESUBMIT.py ('k') | build/android/pylib/base/test_dispatcher.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 for running tests on a single device.""" 5 """Base class for running tests on a single device."""
6 6
7 # TODO(jbudorick) Deprecate and remove this class and all subclasses after 7 # TODO(jbudorick) Deprecate and remove this class and all subclasses after
8 # any relevant parts have been ported to the new environment + test instance 8 # any relevant parts have been ported to the new environment + test instance
9 # model. 9 # model.
10 10
11 import logging 11 import logging
12 12
13 from pylib import ports 13 from pylib import ports
14 from pylib.device import device_utils 14 from pylib.device import device_utils
15 from pylib.forwarder import Forwarder 15 from pylib.forwarder import Forwarder
16 from pylib.valgrind_tools import CreateTool 16 from pylib.valgrind_tools import CreateTool
17 # TODO(frankf): Move this to pylib/utils 17 # TODO(frankf): Move this to pylib/utils
18 import lighttpd_server 18 import lighttpd_server
19 19
20 20
21 # A file on device to store ports of net test server. The format of the file is 21 # A file on device to store ports of net test server. The format of the file is
22 # test-spawner-server-port:test-server-port 22 # test-spawner-server-port:test-server-port
23 NET_TEST_SERVER_PORT_INFO_FILE = 'net-test-server-ports' 23 NET_TEST_SERVER_PORT_INFO_FILE = 'net-test-server-ports'
24 24
25 25
26 class BaseTestRunner(object): 26 class BaseTestRunner(object):
27 """Base class for running tests on a single device.""" 27 """Base class for running tests on a single device."""
28 28
29 def __init__(self, device, tool): 29 def __init__(self, device_serial, tool):
30 """ 30 """
31 Args: 31 Args:
32 device: An instance of DeviceUtils that the tests will run on. 32 device: Tests will run on the device of this ID.
33 tool: Name of the Valgrind tool. 33 tool: Name of the Valgrind tool.
34 """ 34 """
35 assert isinstance(device, device_utils.DeviceUtils) 35 self.device_serial = device_serial
36 self.device = device 36 self.device = device_utils.DeviceUtils(device_serial)
37 self.device_serial = self.device.adb.GetDeviceSerial()
38 self.tool = CreateTool(tool, self.device) 37 self.tool = CreateTool(tool, self.device)
39 self._http_server = None 38 self._http_server = None
40 self._forwarder_device_port = 8000 39 self._forwarder_device_port = 8000
41 self.forwarder_base_url = ('http://localhost:%d' % 40 self.forwarder_base_url = ('http://localhost:%d' %
42 self._forwarder_device_port) 41 self._forwarder_device_port)
43 # We will allocate port for test server spawner when calling method 42 # We will allocate port for test server spawner when calling method
44 # LaunchChromeTestServerSpawner and allocate port for test server when 43 # LaunchChromeTestServerSpawner and allocate port for test server when
45 # starting it in TestServerThread. 44 # starting it in TestServerThread.
46 self.test_server_spawner_port = 0 45 self.test_server_spawner_port = 0
47 self.test_server_port = 0 46 self.test_server_port = 0
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 # will be left open even after the forwarder has been killed. 128 # will be left open even after the forwarder has been killed.
130 if not ports.IsDevicePortUsed(self.device, self._forwarder_device_port): 129 if not ports.IsDevicePortUsed(self.device, self._forwarder_device_port):
131 self._ForwardPortsForHttpServer() 130 self._ForwardPortsForHttpServer()
132 131
133 def ShutdownHelperToolsForTestSuite(self): 132 def ShutdownHelperToolsForTestSuite(self):
134 """Shuts down the server and the forwarder.""" 133 """Shuts down the server and the forwarder."""
135 if self._http_server: 134 if self._http_server:
136 self._UnmapPorts([(self._forwarder_device_port, self._http_server.port)]) 135 self._UnmapPorts([(self._forwarder_device_port, self._http_server.port)])
137 self._http_server.ShutdownHttpServer() 136 self._http_server.ShutdownHttpServer()
138 137
OLDNEW
« no previous file with comments | « build/android/PRESUBMIT.py ('k') | build/android/pylib/base/test_dispatcher.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698