chrome/test/chromedriver/log_replay/client_replay.py
def _HandleGetSessions(self, first_command):
    """Special case handler for the GetSessions command.

    Since it is dispatched to each session thread, GetSessions doesn't guarantee
    command-response-command-response ordering in the log. This happens with
    getSessions, which is broadcast to and logged by each of the active sessions
    in the ChromeDriver instance. This simply consumes all the necessary logs
    resulting from that command until it reaches the next command in the log.

    This results in one returned |overall_response|, which is a list of the
    responses from each GetSessions sub-call. This is not the same as what is
    in the log file, but it is what ChromeDriver returns in real life.

    Args:
      first_command: The first GetSessions command from the log

    Returns:
      first_command: the command that triggered all of the calls absorbed by
        this function
    """

    command_response_pairs = collections.defaultdict(dict)
    command_response_pairs[first_command.session_id] = (
        {"command": first_command})

    while True:
      next_entry = self._parser.GetNext()
      if not next_entry:
        self._parser.UndoGetNext(next_entry)
        break
      if next_entry.IsResponse():
        command_response_pairs[next_entry.session_id]["response"] = next_entry
      elif next_entry.IsCommand():
        if (next_entry.name != first_command.name
            or next_entry.session_id in command_response_pairs):
          self._parser.UndoGetNext(next_entry)
          break
        command_response_pairs[next_entry.session_id]["command"] = next_entry

    response = [
        {u"id": key, u"capabilities": val["response"].GetPayloadPrimitive()}
        for key, val in command_response_pairs.items()
    ]
    self._last_response = _GetSessionsResponseEntry(response)

    return first_command
Special case handler for the GetSessions command.

    Since it is dispatched to each session thread, GetSessions doesn't guarantee
    command-response-command-response ordering in the log. This happens with
    getSessions, which is broadcast to and logged by each of the active sessions
    in the ChromeDriver instance. This simply consumes all the necessary logs
    resulting from that command until it reaches the next command in the log.

    This results in one returned |overall_response|, which is a list of the
    responses from each GetSessions sub-call. This is not the same as what is
    in the log file, but it is what ChromeDriver returns in real life.

    Args:
      first_command: The first GetSessions command from the log

    Returns:
      first_command: the command that triggered all of the calls absorbed by
        this function
    
Special case handler for the GetSessions command.
Since it is dispatched to each session thread, GetSessions doesn't guarantee
command-response-command-response ordering in the log. This happens with
getSessions, which is broadcast to and logged by each of the active sessions
in the ChromeDriver instance. This simply consumes all the necessary logs
resulting from that command until it reaches the next command in the log.

This results in one returned |overall_response|, which is a list of the
responses from each GetSessions sub-call. This is not the same as what is
in the log file, but it is what ChromeDriver returns in real life.
Special case handler for the GetSessions command . Since it is dispatched to each session thread GetSessions doesn ' t guarantee command - response - command - response ordering in the log . This happens with getSessions which is broadcast to and logged by each of the active sessions in the ChromeDriver instance . This simply consumes all the necessary logs resulting from that command until it reaches the next command in the log . This results in one returned |overall_response| which is a list of the responses from each GetSessions sub - call . This is not the same as what is in the log file but it is what ChromeDriver returns in real life .
def _HandleGetSessions(self, first_command):
    command_response_pairs = collections.defaultdict(dict)
    command_response_pairs[first_command.session_id] = (
        {"command": first_command})
    while True:
      next_entry = self._parser.GetNext()
      if not next_entry:
        self._parser.UndoGetNext(next_entry)
        break
      if next_entry.IsResponse():
        command_response_pairs[next_entry.session_id]["response"] = next_entry
      elif next_entry.IsCommand():
        if (next_entry.name != first_command.name
            or next_entry.session_id in command_response_pairs):
          self._parser.UndoGetNext(next_entry)
          break
        command_response_pairs[next_entry.session_id]["command"] = next_entry
    response = [
        {u"id": key, u"capabilities": val["response"].GetPayloadPrimitive()}
        for key, val in command_response_pairs.items()
    ]
    self._last_response = _GetSessionsResponseEntry(response)
    return first_command
def _HandleGetSessions ( self , first_command ) : command_response_pairs = collections . defaultdict ( dict ) command_response_pairs [ first_command . session_id ] = ( { "command" : first_command } ) while True : next_entry = self . _parser . GetNext ( ) if not next_entry : self . _parser . UndoGetNext ( next_entry ) break if next_entry . IsResponse ( ) : command_response_pairs [ next_entry . session_id ] [ "response" ] = next_entry elif next_entry . IsCommand ( ) : if ( next_entry . name != first_command . name or next_entry . session_id in command_response_pairs ) : self . _parser . UndoGetNext ( next_entry ) break command_response_pairs [ next_entry . session_id ] [ "command" ] = next_entry response = [ { u"id" : key , u"capabilities" : val [ "response" ] . GetPayloadPrimitive ( ) } for key , val in command_response_pairs . items ( ) ] self . _last_response = _GetSessionsResponseEntry ( response ) return first_command
Special case handler for the GetSessions command.
Special case handler for the GetSessions command .
"""Special case handler for the GetSessions command.

    Since it is dispatched to each session thread, GetSessions doesn't guarantee
    command-response-command-response ordering in the log. This happens with
    getSessions, which is broadcast to and logged by each of the active sessions
    in the ChromeDriver instance. This simply consumes all the necessary logs
    resulting from that command until it reaches the next command in the log.

    This results in one returned |overall_response|, which is a list of the
    responses from each GetSessions sub-call. This is not the same as what is
    in the log file, but it is what ChromeDriver returns in real life.

    Args:
      first_command: The first GetSessions command from the log

    Returns:
      first_command: the command that triggered all of the calls absorbed by
        this function
    """
the command that triggered all of the calls absorbed by
this function
the command that triggered all of the calls absorbed by this function
first_command
self
first_command
The first GetSessions command from the log
The first GetSessions command from the log