testing/chromoting/chromoting_test_utilities.py
def RestartMe2MeHost():
  """Stops and starts the Me2Me host on the test machine.

  Launches the me2me start-host command, and parses the stdout of the execution
  to obtain the host log-file name.

  Returns:
    log_file: Host log file.

  Raises:
    Exception: If host-log does not contain string indicating host is ready.
  """

  # To start the host, we want to be in the temp-folder for this test execution.
  # Store the current folder to return back to it later.
  previous_directory = os.getcwd()
  os.chdir(ISOLATE_TEMP_FOLDER)

  # Stop chromoting host.
  RunCommandInSubProcess(CHROMOTING_HOST_PATH + ' --stop')
  # Start chromoting host.
  print('Starting chromoting host from %s' % CHROMOTING_HOST_PATH)
  results = RunCommandInSubProcess(CHROMOTING_HOST_PATH + ' --start')

  os.chdir(previous_directory)

  # Get log file from results of above command printed to stdout. Example:
  # Log file: /tmp/tmp0c3EcP/chrome_remote_desktop_20150929_101525_B0o89t
  start_of_host_log = results.index('Log file: ') + len('Log file: ')
  log_file = results[start_of_host_log:].rstrip()

  # Confirm that the start process completed, and we got:
  # "Host ready to receive connections." in the log.
  if HOST_READY_INDICATOR not in results:
    # Host start failed. Print out host-log. Don't run any tests.
    with open(log_file, 'r') as f:
      print(f.read())
    raise HostOperationFailedException('Host restart failed.')

  return log_file
Stops and starts the Me2Me host on the test machine.

  Launches the me2me start-host command, and parses the stdout of the execution
  to obtain the host log-file name.

  Returns:
    log_file: Host log file.

  Raises:
    Exception: If host-log does not contain string indicating host is ready.
  
Stops and starts the Me2Me host on the test machine.
Launches the me2me start-host command, and parses the stdout of the execution
to obtain the host log-file name.
Stops and starts the Me2Me host on the test machine . Launches the me2me start - host command and parses the stdout of the execution to obtain the host log - file name .
def RestartMe2MeHost():
  previous_directory = os.getcwd()
  os.chdir(ISOLATE_TEMP_FOLDER)
  RunCommandInSubProcess(CHROMOTING_HOST_PATH + ' --stop')
  print('Starting chromoting host from %s' % CHROMOTING_HOST_PATH)
  results = RunCommandInSubProcess(CHROMOTING_HOST_PATH + ' --start')
  os.chdir(previous_directory)
  start_of_host_log = results.index('Log file: ') + len('Log file: ')
  log_file = results[start_of_host_log:].rstrip()
  if HOST_READY_INDICATOR not in results:
    with open(log_file, 'r') as f:
      print(f.read())
    raise HostOperationFailedException('Host restart failed.')
  return log_file
def RestartMe2MeHost ( ) : previous_directory = os . getcwd ( ) os . chdir ( ISOLATE_TEMP_FOLDER ) RunCommandInSubProcess ( CHROMOTING_HOST_PATH + ' --stop' ) print ( 'Starting chromoting host from %s' % CHROMOTING_HOST_PATH ) results = RunCommandInSubProcess ( CHROMOTING_HOST_PATH + ' --start' ) os . chdir ( previous_directory ) start_of_host_log = results . index ( 'Log file: ' ) + len ( 'Log file: ' ) log_file = results [ start_of_host_log : ] . rstrip ( ) if HOST_READY_INDICATOR not in results : with open ( log_file , 'r' ) as f : print ( f . read ( ) ) raise HostOperationFailedException ( 'Host restart failed.' ) return log_file
Stops and starts the Me2Me host on the test machine.
Stops and starts the Me2Me host on the test machine .
"""Stops and starts the Me2Me host on the test machine.

  Launches the me2me start-host command, and parses the stdout of the execution
  to obtain the host log-file name.

  Returns:
    log_file: Host log file.

  Raises:
    Exception: If host-log does not contain string indicating host is ready.
  """ # To start the host, we want to be in the temp-folder for this test execution. # Store the current folder to return back to it later. # Stop chromoting host. # Start chromoting host. # Get log file from results of above command printed to stdout. Example: # Log file: /tmp/tmp0c3EcP/chrome_remote_desktop_20150929_101525_B0o89t # Confirm that the start process completed, and we got: # "Host ready to receive connections." in the log. # Host start failed. Print out host-log. Don't run any tests.
Host log file.
Host log file .
log_file
If host-log does not contain string indicating host is ready.
If host - log does not contain string indicating host is ready .
Exception