def SetUp(self): """Sets up the test harness and device before all tests are run.""" super(TestRunner, self).SetUp() if not self.adb.IsRootEnabled(): logging.warning('Unable to enable java asserts for %s, non rooted device', self.device) else: if self.adb.SetJavaAssertsEnabled(enable=not self.disable_assertions): self.adb.Reboot(full_reboot=False) # We give different default value to launch HTTP server based on shard index # because it may have race condition when multiple processes are trying to # launch lighttpd with same port at same time. http_server_ports = self.LaunchTestHttpServer( os.path.join(constants.CHROME_DIR), (constants.LIGHTTPD_RANDOM_PORT_FIRST + self.shard_index)) if self.ports_to_forward: port_pairs = [(port, port) for port in self.ports_to_forward] # We need to remember which ports the HTTP server is using, since the # forwarder will stomp on them otherwise. port_pairs.append(http_server_ports) self.forwarder = Forwarder(self.adb, self.build_type) self.forwarder.Run(port_pairs, self.tool, '127.0.0.1') self.CopyTestFilesOnce() self.flags.AddFlags(['--enable-test-intents'])
def _CreateAndRunForwarder(self, adb, port_pairs, tool, host_name, build_type): """Creates and run a forwarder.""" forwarder = Forwarder(adb, build_type) forwarder.Run(port_pairs, tool, host_name) return forwarder
def _ForwardPort(self, port_pairs): """Creates a forwarder instance if needed and forward a port.""" if not self._forwarder: self._forwarder = Forwarder(self.adb, self.build_type) self._forwarder.Run(port_pairs, self.tool, '127.0.0.1')