예제 #1
0
 def LaunchChromeTestServerSpawner(self):
     """Launches test server spawner."""
     self._spawning_server = SpawningServer(TEST_SERVER_SPAWNER_PORT,
                                            TEST_SERVER_PORT)
     self._spawning_server.Start()
     # TODO(yfriedman): Ideally we'll only try to start up a port forwarder if
     # there isn't one already running but for now we just get an error message
     # and the existing forwarder still works.
     self._spawner_forwarder = run_tests_helper.ForwardDevicePorts(
         self.adb, [(TEST_SERVER_SPAWNER_PORT, TEST_SERVER_SPAWNER_PORT),
                    (TEST_SERVER_PORT, TEST_SERVER_PORT)])
예제 #2
0
    def StartForwarderForHttpServer(self):
        """Starts a forwarder for the HTTP server.

    The forwarder forwards HTTP requests and responses between host and device.
    """
        # Sometimes the forwarder device port may be already used. We have to kill
        # all forwarder processes to ensure that the forwarder can be started since
        # currently we can not associate the specified port to related pid.
        # TODO(yfriedman/wangxianzhu): This doesn't work as most of the time the
        # port is in use but the forwarder is already dead. Killing all forwarders
        # is overly destructive and breaks other tests which make use of forwarders.
        # if IsDevicePortUsed(self.adb, self._forwarder_device_port):
        #   self.adb.KillAll('forwarder')
        self._forwarder = run_tests_helper.ForwardDevicePorts(
            self.adb, [(self._forwarder_device_port, self._http_server.port)])