Пример #1
0
    def setUp(self):
        super().setUp()

        if is_unity7_running():
            self.useFixture(toolkit_fixtures.HideUnity7Launcher())

        if model() != 'Desktop':
            # On the phone, we need unity to be running and unlocked.
            self.addCleanup(process_helpers.stop_job, 'unity8')
            process_helpers.restart_unity_with_testability()
            process_helpers.unlock_unity()

        self.ensure_dash_not_running()

        if self.qml_mock_enabled:
            self.environment['QML2_IMPORT_PATH'] = (
                get_qml_import_path_with_mock())

        if self.should_simulate_device():
            # This sets the grid units, so it should be called before launching
            # the app.
            self.simulate_device()

        binary_path = get_binary_path('unity8-dash')
        dash_proxy = self.launch_dash(binary_path, self.environment)

        self.dash_app = dash_helpers.DashApp(dash_proxy)
        self.dash = self.dash_app.dash
        self.wait_for_dash()
Пример #2
0
    def setUpClass(cls):
        try:
            logger.debug("Creating the override file.")
            with open(
                UbuntuKeyboardTests.maliit_override_file, 'w'
            ) as override_file:
                override_file.write("exec maliit-server -testability")

            process_helpers.restart_unity_with_testability()
            _assertUnityReady()
            #### FIXME: This is a work around re: lp:1238417 ####
            if model() != "Desktop":
                from autopilot.input import _uinput
                _uinput._touch_device = _uinput.create_touch_device()
            ####

            #### FIXME: Workaround re: lp:1248902 and lp:1248913
            logger.debug("Waiting for maliit-server to be ready")
            sleep(10)
            ####

        except IOError as e:
            e.args += (
                "Failed attempting to write override file to {file}".format(
                    file=UbuntuKeyboardTests.maliit_override_file
                ),
            )
            raise
Пример #3
0
    def setUp(self):
        super().setUp()

        if is_unity7_running():
            self.useFixture(toolkit_fixtures.HideUnity7Launcher())

        if model() != 'Desktop':
            # On the phone, we need unity to be running and unlocked.
            self.addCleanup(process_helpers.stop_job, 'unity8')
            process_helpers.restart_unity_with_testability()
            process_helpers.unlock_unity()

        self.ensure_dash_not_running()

        if self.qml_mock_enabled:
            self.environment['QML2_IMPORT_PATH'] = (
                get_qml_import_path_with_mock()
            )

        if self.should_simulate_device():
            # This sets the grid units, so it should be called before launching
            # the app.
            self.simulate_device()

        binary_path = get_binary_path('unity8-dash')
        dash_proxy = self.launch_dash(binary_path, self.environment)

        self.dash_app = dash_helpers.DashApp(dash_proxy)
        self.dash = self.dash_app.dash
        self.wait_for_dash()
Пример #4
0
    def restart_unity_with_testability(self):
        self._unlink_mir_socket()

        binary_arg = 'BINARY={}'.format(self.binary_path)
        variable_args = [
            '{}={}'.format(key, value) for key, value in self.variables.items()
        ]
        all_args = [binary_arg] + variable_args

        self.unity_proxy = process_helpers.restart_unity_with_testability(
            *all_args)
Пример #5
0
    def _restart_unity_with_testability(self):
        _environment = {}

        data_dirs = get_data_dirs(True)
        if data_dirs is not None:
            _environment['XDG_DATA_DIRS'] = data_dirs

        _environment['QML2_IMPORT_PATH'] = (
            self._get_qml_import_path_with_mock()
        )

        new_ld_library_path = [
            get_default_extra_mock_libraries(),
            self._get_lightdm_mock_path()
        ]
        if os.getenv('LD_LIBRARY_PATH') is not None:
            new_ld_library_path.append(os.getenv('LD_LIBRARY_PATH'))
        new_ld_library_path = ':'.join(new_ld_library_path)
        _environment['LD_LIBRARY_PATH'] = new_ld_library_path

        # FIXME: we shouldn't be doing this
        # $MIR_SOCKET, fallback to $XDG_RUNTIME_DIR/mir_socket and
        # /tmp/mir_socket as last resort
        try:
            os.unlink(
                os.getenv('MIR_SOCKET',
                          os.path.join(os.getenv('XDG_RUNTIME_DIR', "/tmp"),
                                       "mir_socket")))
        except OSError:
            pass
        try:
            os.unlink("/tmp/mir_socket")
        except OSError:
            pass

        binary_arg = "BINARY=%s" % get_binary_path()
        env_args = ["%s=%s" % (k, v) for k, v in _environment.items()]
        args = [binary_arg] + env_args
        self.unity_proxy = process_helpers.restart_unity_with_testability(
            *args)
        self.main_win = self.unity_proxy.select_single(shell.ShellView)