예제 #1
0
 def setUp(self):
   # We want a clean session_manager instance for every run,
   # so restart ui now.
   cros_ui.stop(allow_fail=True)
   cryptohome.remove_all_vaults()
   cros_ui.start(wait_for_login_prompt=False)
   pyauto.PyUITest.setUp(self)
예제 #2
0
 def setUp(self):
   # We want a clean session_manager instance for every run,
   # so restart ui now.
   cros_ui.stop(allow_fail=True)
   cryptohome.remove_all_vaults()
   cros_ui.start(wait_for_login_prompt=False)
   pyauto.PyUITest.setUp(self)
  def _WriteDevicePolicyWithSessionManagerStopped(self, policy):
    """Writes the device policy blob while the Session Manager is stopped."""
    assert pyauto.PyUITest.IsChromeOS()
    logging.debug('Stopping session manager')
    cros_ui.stop()
    logging.debug('Writing device policy cache')
    self._WriteDevicePolicy(policy)

    # Ugly hack: session manager won't spawn chrome if this file exists. That's
    # usually a good thing (to keep the automation channel open), but in this
    # case we really want to restart chrome. PyUITest.setUp() will be called
    # after session manager and chrome have restarted, and will setup the
    # automation channel.
    restore_magic_file = False
    if os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE):
      logging.debug('DISABLE_BROWSER_RESTART_MAGIC_FILE found. '
                    'Removing temporarily for the next restart.')
      restore_magic_file = True
      os.remove(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
      assert not os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)

    logging.debug('Starting session manager again')
    cros_ui.start()

    # cros_ui.start() waits for the login prompt to be visible, so chrome has
    # already started once it returns.
    if restore_magic_file:
      open(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE, 'w').close()
      assert os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
예제 #4
0
  def _StartSessionManagerAndChrome(self):
    """Starts the session manager and Chrome.

    Requires that the session manager be stopped already.
    """
    # Ugly hack: session manager will not spawn Chrome if this file exists. That
    # is usually a good thing (to keep the automation channel open), but in this
    # case we really want to restart chrome. PyUITest.setUp() will be called
    # after session manager and chrome have restarted, and will setup the
    # automation channel.
    restore_magic_file = False
    if os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE):
      logging.debug('DISABLE_BROWSER_RESTART_MAGIC_FILE found. '
                    'Removing temporarily for the next restart.')
      restore_magic_file = True
      os.remove(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
      assert not os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)

    logging.debug('Starting session manager again')
    cros_ui.start()

    # cros_ui.start() waits for the login prompt to be visible, so Chrome has
    # already started once it returns.
    if restore_magic_file:
      open(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE, 'w').close()
      assert os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
예제 #5
0
  def _WriteDevicePolicyWithSessionManagerStopped(self):
    """Writes the device policy blob while the session manager is stopped.

    Updates the files holding the device policy blob and the public key need to
    verify its signature.
    """
    assert self.IsChromeOS()
    logging.debug('Stopping session manager')
    cros_ui.stop(allow_fail=True)
    logging.debug('Writing device policy blob')
    self._WriteFile(constants.SIGNED_POLICY_FILE, self._device_policy_blob)
    self._WriteFile(constants.OWNER_KEY_FILE, self._public_key)

    # Ugly hack: session manager will not spawn Chrome if this file exists. That
    # is usually a good thing (to keep the automation channel open), but in this
    # case we really want to restart chrome. PyUITest.setUp() will be called
    # after session manager and chrome have restarted, and will setup the
    # automation channel.
    restore_magic_file = False
    if os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE):
      logging.debug('DISABLE_BROWSER_RESTART_MAGIC_FILE found. '
                    'Removing temporarily for the next restart.')
      restore_magic_file = True
      os.remove(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
      assert not os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)

    logging.debug('Starting session manager again')
    cros_ui.start()

    # cros_ui.start() waits for the login prompt to be visible, so Chrome has
    # already started once it returns.
    if restore_magic_file:
      open(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE, 'w').close()
      assert os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
예제 #6
0
    def _WriteDevicePolicyWithSessionManagerStopped(self):
        """Writes the device policy blob while the session manager is stopped.

    Updates the files holding the device policy blob and the public key need to
    verify its signature.
    """
        assert self.IsChromeOS()
        logging.debug('Stopping session manager')
        cros_ui.stop(allow_fail=True)
        logging.debug('Writing device policy blob')
        self._WriteFile(constants.SIGNED_POLICY_FILE, self._device_policy_blob)
        self._WriteFile(constants.OWNER_KEY_FILE, self._public_key)

        # Ugly hack: session manager will not spawn Chrome if this file exists. That
        # is usually a good thing (to keep the automation channel open), but in this
        # case we really want to restart chrome. PyUITest.setUp() will be called
        # after session manager and chrome have restarted, and will setup the
        # automation channel.
        restore_magic_file = False
        if os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE):
            logging.debug('DISABLE_BROWSER_RESTART_MAGIC_FILE found. '
                          'Removing temporarily for the next restart.')
            restore_magic_file = True
            os.remove(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
            assert not os.path.exists(
                constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)

        logging.debug('Starting session manager again')
        cros_ui.start()

        # cros_ui.start() waits for the login prompt to be visible, so Chrome has
        # already started once it returns.
        if restore_magic_file:
            open(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE, 'w').close()
            assert os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
예제 #7
0
    def _StartSessionManagerAndChrome(self):
        """Starts the session manager and Chrome.

    Requires that the session manager be stopped already.
    """
        # Ugly hack: session manager will not spawn Chrome if this file exists. That
        # is usually a good thing (to keep the automation channel open), but in this
        # case we really want to restart chrome. PyUITest.setUp() will be called
        # after session manager and chrome have restarted, and will setup the
        # automation channel.
        restore_magic_file = False
        if os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE):
            logging.debug('DISABLE_BROWSER_RESTART_MAGIC_FILE found. '
                          'Removing temporarily for the next restart.')
            restore_magic_file = True
            os.remove(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
            assert not os.path.exists(
                constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)

        logging.debug('Starting session manager again')
        cros_ui.start()

        # cros_ui.start() waits for the login prompt to be visible, so Chrome has
        # already started once it returns.
        if restore_magic_file:
            open(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE, 'w').close()
            assert os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
예제 #8
0
  def _WriteDevicePolicyWithSessionManagerStopped(self, policy):
    """Writes the device policy blob while the Session Manager is stopped."""
    assert self.IsChromeOS()
    logging.debug('Stopping session manager')
    cros_ui.stop(allow_fail=True)
    logging.debug('Writing device policy cache')
    self._WriteDevicePolicy(policy)

    # Ugly hack: session manager won't spawn chrome if this file exists. That's
    # usually a good thing (to keep the automation channel open), but in this
    # case we really want to restart chrome. PyUITest.setUp() will be called
    # after session manager and chrome have restarted, and will setup the
    # automation channel.
    restore_magic_file = False
    if os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE):
      logging.debug('DISABLE_BROWSER_RESTART_MAGIC_FILE found. '
                    'Removing temporarily for the next restart.')
      restore_magic_file = True
      os.remove(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
      assert not os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)

    logging.debug('Starting session manager again')
    cros_ui.start()

    # cros_ui.start() waits for the login prompt to be visible, so chrome has
    # already started once it returns.
    if restore_magic_file:
      open(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE, 'w').close()
      assert os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)