def _RestartHttpServerForwarderIfNecessary(self):
   """Restarts the forwarder if it's not open."""
   # Checks to see if the http server port is being used.  If not forwards the
   # request.
   # TODO(dtrainor): This is not always reliable because sometimes the port
   # will be left open even after the forwarder has been killed.
   if not ports.IsDevicePortUsed(self.device, self._forwarder_device_port):
     self._ForwardPortsForHttpServer()
示例#2
0
def _CheckDevicePortStatus(device, port):
    """Returns whether the provided port is used."""
    return _WaitUntil(lambda: ports.IsDevicePortUsed(device, port))
示例#3
0
 def WaitDevicePortReady(self, port):
     return _WaitUntil(lambda: ports.IsDevicePortUsed(self.device, port))