def setUp(self):
        options = _ParseCommandLine([
            '--lacros', '--nostrip', '--build-dir', '/path/to/nowhere',
            '--device', 'monkey'
        ])
        self.deploy = deploy_chrome.DeployChrome(
            options, self.tempdir, os.path.join(self.tempdir, 'staging'))

        # These methods being mocked are all side effects expected for a --lacros
        # deploy.
        self.deploy._EnsureTargetDir = mock.Mock()
        self.deploy._GetDeviceInfo = mock.Mock()
        self.deploy._CheckConnection = mock.Mock()
        self.deploy._MountRootfsAsWritable = mock.Mock()
        self.deploy._PrepareStagingDir = mock.Mock()
        self.deploy._CheckDeviceFreeSpace = mock.Mock()

        self._ran_start_command = False

        self.StartPatcher(parallel_unittest.ParallelMock())

        # Common mocking shared between tests.
        def kill_procs_side_effect():
            self.deploy._stopped_ui = True

        self.deploy._KillAshChromeIfNeeded = mock.Mock(
            side_effect=kill_procs_side_effect)

        def start_ui_side_effect(*args, **kwargs):
            # pylint: disable=unused-argument
            self._ran_start_command = True

        self.rc.AddCmdResult(partial_mock.In('start ui'),
                             side_effect=start_ui_side_effect)
 def setUp(self):
     options = _ParseCommandLine(
         list(_REGULAR_TO) + [
             '--board', _TARGET_BOARD, '--force', '--mount', '--build-dir',
             os.path.join(self.tempdir, 'build_dir'), '--nostrip'
         ])
     self.deploy = deploy_chrome.DeployChrome(
         options, self.tempdir, os.path.join(self.tempdir, 'staging'))
示例#3
0
 def _GetDeployChrome(self, args):
     options = _ParseCommandLine(args)
     return deploy_chrome.DeployChrome(
         options, self.tempdir, os.path.join(self.tempdir, 'staging'))