chrome/test/chromedriver/log_replay/client_replay.py
def _ReplaceBinary(payload, binary):
  """Replace the binary path in |payload| with the one in |binary|.

  If |binary| exists but there is no binary in |payload|, it is added at the
  appropriate location. Operates in-place.

  Args:
    payload: InitSession payload as a dictionary to replace binary in
    binary: new binary to replace in payload. If binary is not truthy, but
    there is a binary path in |payload|, we remove the binary path, which will
    trigger ChromeDriver's mechanism for locating the Chrome binary.
  """
  if ("desiredCapabilities" in payload
      and "goog:chromeOptions" in payload["desiredCapabilities"]):
    if binary:
      (payload["desiredCapabilities"]["goog:chromeOptions"]
       ["binary"]) = binary
    elif "binary" in payload["desiredCapabilities"]["goog:chromeOptions"]:
      del payload["desiredCapabilities"]["goog:chromeOptions"]["binary"]

  elif binary:
    if "desiredCapabilities" not in payload:
      payload["desiredCapabilities"] = {
          "goog:chromeOptions": {
              "binary": binary
          }
      }
    elif "goog:chromeOptions" not in payload["desiredCapabilities"]:
      payload["desiredCapabilities"]["goog:chromeOptions"] = {
          "binary": binary
      }
Replace the binary path in |payload| with the one in |binary|.

  If |binary| exists but there is no binary in |payload|, it is added at the
  appropriate location. Operates in-place.

  Args:
    payload: InitSession payload as a dictionary to replace binary in
    binary: new binary to replace in payload. If binary is not truthy, but
    there is a binary path in |payload|, we remove the binary path, which will
    trigger ChromeDriver's mechanism for locating the Chrome binary.
  
Replace the binary path in |payload| with the one in |binary|.
If |binary| exists but there is no binary in |payload|, it is added at the
appropriate location. Operates in-place.

InitSession payload as a dictionary to replace binary in
binary: new binary to replace in payload. If binary is not truthy, but
there is a binary path in |payload|, we remove the binary path, which will
trigger ChromeDriver's mechanism for locating the Chrome binary.
Replace the binary path in |payload| with the one in |binary| . If |binary| exists but there is no binary in |payload| it is added at the appropriate location . Operates in - place . InitSession payload as a dictionary to replace binary in binary : new binary to replace in payload . If binary is not truthy but there is a binary path in |payload| we remove the binary path which will trigger ChromeDriver ' s mechanism for locating the Chrome binary .
def _ReplaceBinary(payload, binary):
  if ("desiredCapabilities" in payload
      and "goog:chromeOptions" in payload["desiredCapabilities"]):
    if binary:
      (payload["desiredCapabilities"]["goog:chromeOptions"]
       ["binary"]) = binary
    elif "binary" in payload["desiredCapabilities"]["goog:chromeOptions"]:
      del payload["desiredCapabilities"]["goog:chromeOptions"]["binary"]
  elif binary:
    if "desiredCapabilities" not in payload:
      payload["desiredCapabilities"] = {
          "goog:chromeOptions": {
              "binary": binary
          }
      }
    elif "goog:chromeOptions" not in payload["desiredCapabilities"]:
      payload["desiredCapabilities"]["goog:chromeOptions"] = {
          "binary": binary
      }
def _ReplaceBinary ( payload , binary ) : if ( "desiredCapabilities" in payload and "goog:chromeOptions" in payload [ "desiredCapabilities" ] ) : if binary : ( payload [ "desiredCapabilities" ] [ "goog:chromeOptions" ] [ "binary" ] ) = binary elif "binary" in payload [ "desiredCapabilities" ] [ "goog:chromeOptions" ] : del payload [ "desiredCapabilities" ] [ "goog:chromeOptions" ] [ "binary" ] elif binary : if "desiredCapabilities" not in payload : payload [ "desiredCapabilities" ] = { "goog:chromeOptions" : { "binary" : binary } } elif "goog:chromeOptions" not in payload [ "desiredCapabilities" ] : payload [ "desiredCapabilities" ] [ "goog:chromeOptions" ] = { "binary" : binary }
Replace the binary path in |payload| with the one in |binary|.
Replace the binary path in |payload| with the one in |binary| .
"""Replace the binary path in |payload| with the one in |binary|.

  If |binary| exists but there is no binary in |payload|, it is added at the
  appropriate location. Operates in-place.

  Args:
    payload: InitSession payload as a dictionary to replace binary in
    binary: new binary to replace in payload. If binary is not truthy, but
    there is a binary path in |payload|, we remove the binary path, which will
    trigger ChromeDriver's mechanism for locating the Chrome binary.
  """
payload
binary