Exemplo n.º 1
0
 def get_port(self, target=None, configuration=None, files=None):
     host = MockHost()
     finder = PathFinder(host.filesystem)
     files = files or {}
     for path, contents in files.items():
         host.filesystem.write_text_file(finder.path_from_chromium_base(path), contents)
     options = optparse.Values({'target': target, 'configuration': configuration})
     return factory.PortFactory(host).get(options=options)
Exemplo n.º 2
0
 def assert_port(self,
                 port_name=None,
                 os_name=None,
                 os_version=None,
                 options=None,
                 cls=None):
     host = MockHost(os_name=os_name, os_version=os_version)
     port = factory.PortFactory(host).get(port_name, options=options)
     self.assertIsInstance(port, cls)
Exemplo n.º 3
0
 def test_get_from_builder_name(self):
     host = MockHost()
     host.builders = BuilderList({
         'My Fake Mac10.12 Builder': {
             'port_name': 'mac-mac10.12',
             'specifiers': ['Mac10.12', 'Release'],
         }
     })
     self.assertEqual(factory.PortFactory(host).get_from_builder_name('My Fake Mac10.12 Builder').name(),
                      'mac-mac10.12')
Exemplo n.º 4
0
    def __init__(self,
                 host,
                 port_name='',
                 apk='',
                 product='',
                 options=None,
                 **kwargs):
        super(AndroidPort, self).__init__(host,
                                          port_name,
                                          options=options,
                                          **kwargs)
        self._operating_system = 'android'
        self._version = 'kitkat'
        fs = host.filesystem
        self._local_port = factory.PortFactory(host).get(**kwargs)
        if apk or product:
            self._driver_details = DriverDetails(apk)
            browser_type = fs.splitext(fs.basename(apk))[0].lower()
            self._browser_type = _friendly_browser_names.get(
                browser_type, browser_type)
            self._wpt_product_arg = product
        else:
            # The legacy test runner will be used to run web tests on Android.
            # So we need to initialize several port member variables.
            _import_android_packages_if_necessary()
            self._driver_details = ContentShellDriverDetails()
            self._browser_type = 'content_shell'
            self._debug_logging = self.get_option('android_logging')
            self.server_process_constructor = self._android_server_process_constructor
            self._wpt_product_arg = ''

            if not self.get_option('disable_breakpad'):
                self._dump_reader = DumpReaderAndroid(host, self._build_path())

            # Initialize the AndroidDevices class which tracks available devices.
            default_devices = None
            if hasattr(self._options, 'adb_devices') and len(
                    self._options.adb_devices):
                default_devices = self._options.adb_devices

            self._devices = AndroidDevices(default_devices,
                                           self._debug_logging)

            devil_chromium.Initialize(output_directory=self._build_path(),
                                      adb_path=self._path_from_chromium_base(
                                          'third_party', 'android_sdk',
                                          'public', 'platform-tools', 'adb'))

            devil_env.config.InitializeLogging(
                logging.DEBUG if self._debug_logging
                and self.get_option('debug_rwt_logging') else logging.WARNING)

            prepared_devices = self.get_option('prepared_devices', [])
            for serial in prepared_devices:
                self._devices.set_device_prepared(serial)
Exemplo n.º 5
0
    def __init__(self, host, port_name, **kwargs):
        super(FuchsiaPort, self).__init__(host, port_name, **kwargs)

        self._operating_system = 'fuchsia'
        self._version = 'fuchsia'

        # TODO(sergeyu): Add support for arm64.
        self._architecture = 'x86_64'

        self.server_process_constructor = FuchsiaServerProcess

        # Used to implement methods that depend on the host platform.
        self._host_port = factory.PortFactory(host).get(**kwargs)

        self._target_host = self.get_option('fuchsia_target')
        self._zircon_logger = None
        _import_fuchsia_runner()
    def __init__(self, host, port_name, **kwargs):
        _import_android_packages_if_necessary()
        super(AndroidPort, self).__init__(host, port_name, **kwargs)

        self._operating_system = 'android'
        self._version = 'kitkat'

        self._host_port = factory.PortFactory(host).get(**kwargs)
        self.server_process_constructor = self._android_server_process_constructor

        if not self.get_option('disable_breakpad'):
            self._dump_reader = DumpReaderAndroid(host, self._build_path())

        if self.driver_name() != self.CONTENT_SHELL_NAME:
            raise AssertionError(
                'Web tests on Android only support content_shell as the driver.'
            )

        self._driver_details = ContentShellDriverDetails()

        # Initialize the AndroidDevices class which tracks available devices.
        default_devices = None
        if hasattr(self._options, 'adb_devices') and len(
                self._options.adb_devices):
            default_devices = self._options.adb_devices

        self._debug_logging = self.get_option('android_logging')
        self._devices = AndroidDevices(default_devices, self._debug_logging)

        devil_chromium.Initialize(output_directory=self._build_path(),
                                  adb_path=self._path_from_chromium_base(
                                      'third_party', 'android_tools', 'sdk',
                                      'platform-tools', 'adb'))
        devil_env.config.InitializeLogging(
            logging.DEBUG if self._debug_logging
            and self.get_option('debug_rwt_logging') else logging.WARNING)

        prepared_devices = self.get_option('prepared_devices', [])
        for serial in prepared_devices:
            self._devices.set_device_prepared(serial)
Exemplo n.º 7
0
 def test_unknown_default(self):
     with self.assertRaises(NotImplementedError):
         factory.PortFactory(MockHost(os_name='vms')).get()
Exemplo n.º 8
0
 def test_unknown_specified(self):
     with self.assertRaises(NotImplementedError):
         factory.PortFactory(MockHost()).get(port_name='unknown')