Beispiel #1
0
class IPadSimulatorPort(IOSSimulatorPort):
    port_name = 'ipad-simulator'

    DEVICE_TYPE = DeviceType(hardware_family='iPad')
    DEFAULT_DEVICE_TYPES = [DeviceType(hardware_family='iPad', hardware_type='(5th generation)')]

    def __init__(self, *args, **kwargs):
        super(IPadSimulatorPort, self).__init__(*args, **kwargs)
        self._config = Config(self._executive, self._filesystem, IOSSimulatorPort.port_name)
Beispiel #2
0
class IPhoneSimulatorPort(IOSSimulatorPort):
    port_name = 'iphone-simulator'

    DEVICE_TYPE = DeviceType(hardware_family='iPhone')
    DEFAULT_DEVICE_TYPES = [
        DeviceType(hardware_family='iPhone', hardware_type='SE'),
        DeviceType(hardware_family='iPhone', hardware_type='7'),
    ]

    def __init__(self, *args, **kwargs):
        super(IPhoneSimulatorPort, self).__init__(*args, **kwargs)
        self._config = Config(self._executive, self._filesystem, IOSSimulatorPort.port_name)
Beispiel #3
0
    def test_comparison(self):
        # iPhone comparisons
        self.assertEqual(DeviceType.from_string('iPhone 6s'),
                         DeviceType.from_string('iPhone'))
        self.assertEqual(DeviceType.from_string('iPhone X'),
                         DeviceType.from_string('iPhone'))
        self.assertNotEqual(DeviceType.from_string('iPhone 6s'),
                            DeviceType.from_string('iPhone X'))

        # iPad comparisons
        self.assertEqual(DeviceType.from_string('iPad Air 2'),
                         DeviceType.from_string('iPad'))
        self.assertEqual(DeviceType.from_string('iPad Pro (12.9-inch)'),
                         DeviceType.from_string('iPad'))
        self.assertNotEqual(DeviceType.from_string('iPad Air 2'),
                            DeviceType.from_string('iPad Pro (12.9-inch)'))

        # Apple Watch comparisons
        self.assertEqual(DeviceType.from_string('Apple Watch Series 2 - 38mm'),
                         DeviceType.from_string('Apple Watch'))
        self.assertEqual(DeviceType.from_string('Apple Watch Series 2 - 42mm'),
                         DeviceType.from_string('Apple Watch'))
        self.assertNotEqual(
            DeviceType.from_string('Apple Watch Series 2 - 38mm'),
            DeviceType.from_string('Apple Watch Series 2 - 42mm'))

        # Apple TV comparisons
        self.assertEqual(DeviceType.from_string('Apple TV 4K'),
                         DeviceType.from_string('Apple TV'))
        self.assertEqual(DeviceType.from_string('Apple TV 4K (at 1080p)'),
                         DeviceType.from_string('Apple TV'))
        self.assertNotEqual(DeviceType.from_string('Apple TV 4K'),
                            DeviceType.from_string('Apple TV 4K (at 1080p)'))

        # Match by software_variant
        self.assertEqual(DeviceType.from_string('iPhone 6s'),
                         DeviceType(software_variant='iOS'))
        self.assertEqual(DeviceType.from_string('iPad Air 2'),
                         DeviceType(software_variant='iOS'))
        self.assertNotEqual(
            DeviceType.from_string('Apple Watch Series 2 - 42mm'),
            DeviceType(software_variant='iOS'))
        self.assertNotEqual(DeviceType.from_string('Apple TV 4K'),
                            DeviceType(software_variant='iOS'))

        # Cross-device comparisons
        self.assertNotEqual(DeviceType.from_string('iPad'),
                            DeviceType.from_string('iPhone'))
        self.assertNotEqual(DeviceType.from_string('Apple Watch'),
                            DeviceType.from_string('iPhone'))
        self.assertNotEqual(DeviceType.from_string('Apple Watch'),
                            DeviceType.from_string('Apple TV'))
Beispiel #4
0
    def test_tv_initialization(self):
        type = DeviceType(hardware_family='TV')
        self.assertEquals('Apple TV', type.hardware_family)
        self.assertEquals(None, type.hardware_type)
        self.assertEquals('tvOS', type.software_variant)
        self.assertEquals(None, type.software_version)
        self.assertEqual('Apple TV running tvOS', str(type))

        type = DeviceType('Apple TV', '4K', Version(11))
        self.assertEquals('Apple TV', type.hardware_family)
        self.assertEquals('4K', type.hardware_type)
        self.assertEquals('tvOS', type.software_variant)
        self.assertEquals(Version(11), type.software_version)
        self.assertEqual('Apple TV 4K running tvOS 11', str(type))
Beispiel #5
0
    def test_ipad_initialization(self):
        type = DeviceType(hardware_family='iPad')
        self.assertEquals('iPad', type.hardware_family)
        self.assertEquals(None, type.hardware_type)
        self.assertEquals('iOS', type.software_variant)
        self.assertEquals(None, type.software_version)
        self.assertEqual('iPad running iOS', str(type))

        type = DeviceType('iPad', 'Air 2', Version(11))
        self.assertEquals('iPad', type.hardware_family)
        self.assertEquals('Air 2', type.hardware_type)
        self.assertEquals('iOS', type.software_variant)
        self.assertEquals(Version(11), type.software_version)
        self.assertEqual('iPad Air 2 running iOS 11', str(type))
Beispiel #6
0
    def test_iphone_initialization(self):
        type = DeviceType(hardware_family='iPhone')
        self.assertEquals('iPhone', type.hardware_family)
        self.assertEquals(None, type.hardware_type)
        self.assertEquals('iOS', type.software_variant)
        self.assertEquals(None, type.software_version)
        self.assertEqual('iPhone running iOS', str(type))

        type = DeviceType('iPhone', '6s', Version(11))
        self.assertEquals('iPhone', type.hardware_family)
        self.assertEquals('6s', type.hardware_type)
        self.assertEquals('iOS', type.software_variant)
        self.assertEquals(Version(11), type.software_version)
        self.assertEqual('iPhone 6s running iOS 11', str(type))
Beispiel #7
0
    def test_watch_initialization(self):
        type = DeviceType(hardware_family='Watch')
        self.assertEquals('Apple Watch', type.hardware_family)
        self.assertEquals(None, type.hardware_type)
        self.assertEquals('watchOS', type.software_variant)
        self.assertEquals(None, type.software_version)
        self.assertEqual('Apple Watch running watchOS', str(type))

        type = DeviceType('Apple Watch', 'Series 2 - 42mm', Version(4))
        self.assertEquals('Apple Watch', type.hardware_family)
        self.assertEquals('Series 2 - 42mm', type.hardware_type)
        self.assertEquals('watchOS', type.software_variant)
        self.assertEquals(Version(4), type.software_version)
        self.assertEqual('Apple Watch Series 2 - 42mm running watchOS 4',
                         str(type))
Beispiel #8
0
 def check_sys_deps(self, needs_http):
     target_device_type = DeviceType(software_variant='iOS', software_version=self.ios_version())
     for device in SimulatedDeviceManager.available_devices(self.host):
         if device.platform_device.device_type in target_device_type:
             return super(IOSSimulatorPort, self).check_sys_deps(needs_http)
     _log.error('No Simulated device matching "{}" defined in Xcode iOS SDK'.format(str(target_device_type)))
     return False
Beispiel #9
0
    def _disambiguate_device_type(device_type):
        # Copy by value since we do not want to modify the DeviceType passed in.
        full_device_type = DeviceType(
            hardware_family=device_type.hardware_family,
            hardware_type=device_type.hardware_type,
            software_version=device_type.software_version,
            software_variant=device_type.software_variant)

        runtime = SimulatedDeviceManager.get_runtime_for_device_type(full_device_type)
        assert runtime is not None
        full_device_type.software_version = runtime.version

        if full_device_type.hardware_family is None:
            # We use the existing devices to determine a legal family if no family is specified
            for device in SimulatedDeviceManager.AVAILABLE_DEVICES:
                if device.device_type == full_device_type:
                    full_device_type.hardware_family = device.device_type.hardware_family
                    break

        if full_device_type.hardware_type is None:
            # Again, we use the existing devices to determine a legal hardware type
            for name in SimulatedDeviceManager._device_identifier_to_name.itervalues():
                type_from_name = DeviceType.from_string(name)
                if type_from_name == full_device_type:
                    full_device_type.hardware_type = type_from_name.hardware_type
                    break

        full_device_type.check_consistency()
        return full_device_type
Beispiel #10
0
 def test_generic_ios_device(self):
     type = DeviceType(software_variant='iOS')
     self.assertEquals(None, type.hardware_family)
     self.assertEquals(None, type.hardware_type)
     self.assertEquals('iOS', type.software_variant)
     self.assertEquals(None, type.software_version)
     self.assertEqual('Device running iOS', str(type))
Beispiel #11
0
 def _device_type_with_version(self, device_type=None):
     device_type = device_type if device_type else self.DEVICE_TYPE
     return DeviceType(
         hardware_family=device_type.hardware_family,
         hardware_type=device_type.hardware_type,
         software_version=self.device_version(),
         software_variant=device_type.software_variant,
     )
Beispiel #12
0
    def test_uses_custom_device(self):
        class MockCustomDevicePort(TestPort):
            CUSTOM_DEVICE_TYPES = [DeviceType(hardware_family='iPad')]

            def __init__(self, host):
                super(MockCustomDevicePort, self).__init__(host)

        def get_manager():
            host = MockHost()
            port = MockCustomDevicePort(host)
            manager = Manager(port,
                              options=MockOptions(
                                  test_list=['fast/ipad/lasers.html'],
                                  http=True),
                              printer=Mock())
            return manager

        manager = get_manager()
        self.assertTrue(
            manager._custom_device_for_test('fast/ipad/lasers.html') ==
            DeviceType(hardware_family='iPad'))
Beispiel #13
0
class WatchSimulatorPort(WatchPort):
    port_name = 'watchos-simulator'

    ARCHITECTURES = ['i386']
    DEFAULT_ARCHITECTURE = 'i386'

    DEVICE_MANAGER = SimulatedDeviceManager

    DEFAULT_DEVICE_TYPE = DeviceType(hardware_family='Apple Watch',
                                     hardware_type='Series 3 - 42mm')
    SDK = apple_additions().get_sdk(
        'watchsimulator') if apple_additions() else 'watchsimulator'

    def architecture(self):
        return self.DEFAULT_ARCHITECTURE

    # This supports the mapping of a port name such as watchos-simulator-5 to the construction of a port
    # using watchOS 5.
    @staticmethod
    def _version_from_name(name):
        if len(name.split('-')) > 2 and name.split('-')[2].isdigit():
            return Version.from_string(name.split('-')[2])
        return None

    @memoized
    def device_version(self):
        if self.get_option('version'):
            return Version.from_string(self.get_option('version'))
        return WatchSimulatorPort._version_from_name(
            self._name) or self.host.platform.xcode_sdk_version(
                'watchsimulator')

    def environment_for_api_tests(self):
        inherited_env = super(WatchSimulatorPort,
                              self).environment_for_api_tests()
        new_environment = {}
        SIMCTL_ENV_PREFIX = 'SIMCTL_CHILD_'
        for value in inherited_env:
            if not value.startswith(SIMCTL_ENV_PREFIX):
                new_environment[SIMCTL_ENV_PREFIX +
                                value] = inherited_env[value]
            else:
                new_environment[value] = inherited_env[value]
        return new_environment

    def operating_system(self):
        return 'watchos-simulator'

    def setup_environ_for_server(self, server_name=None):
        _log.debug('Setting up environment for server on {}'.format(
            self.operating_system()))
        env = super(WatchSimulatorPort,
                    self).setup_environ_for_server(server_name)
        if server_name == self.driver_name() and self.get_option('leaks'):
            env['MallocStackLogging'] = '1'
            env['__XPC_MallocStackLogging'] = '1'
            env['MallocScribble'] = '1'
            env['__XPC_MallocScribble'] = '1'
        return env

    def reset_preferences(self):
        SimulatedDeviceManager.tear_down(self.host)

    def nm_command(self):
        return self.xcrun_find('nm')

    @property
    @memoized
    def developer_dir(self):
        return self._executive.run_command(['xcode-select',
                                            '--print-path']).rstrip()

    def logging_patterns_to_strip(self):
        return []

    def stderr_patterns_to_strip(self):
        return []
Beispiel #14
0
class WatchPort(DevicePort):
    port_name = 'watchos'

    CURRENT_VERSION = Version(5)
    DEFAULT_DEVICE_TYPE = DeviceType(software_variant='watchOS')

    def __init__(self, *args, **kwargs):
        super(WatchPort, self).__init__(*args, **kwargs)

        if self.get_option('webkit_test_runner', False) == False:
            raise RuntimeError('DumpRenderTree is not supported on this platform.')

    def driver_name(self):
        if self.get_option('driver_name'):
            return self.get_option('driver_name')
        return 'WebKitTestRunnerApp.app'

    def version_name(self):
        if self._os_version is None:
            return None
        return VersionNameMap.map(self.host.platform).to_name(self._os_version, platform=WatchPort.port_name)

    def test_expectations_file_position(self):
        return 4

    @memoized
    def default_baseline_search_path(self):
        versions_to_fallback = []
        if self.device_version() == self.CURRENT_VERSION:
            versions_to_fallback = [self.CURRENT_VERSION]
        elif self.device_version():
            temp_version = Version(self.device_version().major)
            while temp_version.major != self.CURRENT_VERSION.major:
                versions_to_fallback.append(Version.from_iterable(temp_version))
                if temp_version < self.CURRENT_VERSION:
                    temp_version.major += 1
                else:
                    temp_version.major -= 1

        expectations = []
        for version in versions_to_fallback:
            if apple_additions():
                apple_name = VersionNameMap.map(self.host.platform).to_name(version, platform=WatchPort.port_name, table=INTERNAL_TABLE)
                expectations.append(self._apple_baseline_path('{}-{}'.format(self.port_name, apple_name.lower().replace(' ', ''))))
            expectations.append(self._webkit_baseline_path('{}-{}'.format(self.port_name, version.major)))

        if apple_additions():
            expectations.append(self._apple_baseline_path(self.port_name))
        expectations.append(self._webkit_baseline_path(self.port_name))

        for version in versions_to_fallback:
            apple_name = None
            if apple_additions():
                apple_name = VersionNameMap.map(self.host.platform).to_name(version, platform=WatchPort.port_name, table=INTERNAL_TABLE)
            if apple_name:
                expectations.append(
                    self._apple_baseline_path('{}-{}'.format(WatchPort.port_name, apple_name.lower().replace(' ', ''))))
            expectations.append(self._webkit_baseline_path('{}-{}'.format(WatchPort.port_name, version.major)))

        if apple_additions():
            expectations.append(self._apple_baseline_path(WatchPort.port_name))
        expectations.append(self._webkit_baseline_path(WatchPort.port_name))

        expectations.append(self._webkit_baseline_path('wk2'))

        return expectations
Beispiel #15
0
class IOSPort(DevicePort):
    port_name = "ios"

    CURRENT_VERSION = Version(12)
    # FIXME: This is not a clear way to do this (although it works) https://bugs.webkit.org/show_bug.cgi?id=192160
    DEFAULT_DEVICE_TYPE = DeviceType(software_variant='iOS')

    def __init__(self, host, port_name, **kwargs):
        super(IOSPort, self).__init__(host, port_name, **kwargs)
        self._test_runner_process_constructor = SimulatorProcess
        self._printing_cmd_line = False

    def version_name(self):
        if self._os_version is None:
            return None
        return VersionNameMap.map(self.host.platform).to_name(
            self._os_version, platform=IOSPort.port_name)

    @memoized
    def default_baseline_search_path(self):
        wk_string = 'wk1'
        if self.get_option('webkit_test_runner'):
            wk_string = 'wk2'

        versions_to_fallback = []
        if self.device_version().major == self.CURRENT_VERSION.major:
            versions_to_fallback = [self.CURRENT_VERSION]
        elif self.device_version():
            temp_version = Version(self.device_version().major)
            while temp_version != self.CURRENT_VERSION:
                versions_to_fallback.append(
                    Version.from_iterable(temp_version))
                if temp_version < self.CURRENT_VERSION:
                    temp_version.major += 1
                else:
                    temp_version.major -= 1

        expectations = []
        for version in versions_to_fallback:
            apple_name = None
            if apple_additions():
                apple_name = VersionNameMap.map(self.host.platform).to_name(
                    version, platform=IOSPort.port_name, table=INTERNAL_TABLE)

            if apple_name:
                expectations.append(
                    self._apple_baseline_path('{}-{}-{}'.format(
                        self.port_name,
                        apple_name.lower().replace(' ', ''), wk_string)))
            expectations.append(
                self._webkit_baseline_path('{}-{}-{}'.format(
                    self.port_name, version.major, wk_string)))
            if apple_name:
                expectations.append(
                    self._apple_baseline_path('{}-{}'.format(
                        self.port_name,
                        apple_name.lower().replace(' ', ''))))
            expectations.append(
                self._webkit_baseline_path('{}-{}'.format(
                    self.port_name, version.major)))

        if apple_additions():
            expectations.append(
                self._apple_baseline_path('{}-{}'.format(
                    self.port_name, wk_string)))
        expectations.append(
            self._webkit_baseline_path('{}-{}'.format(self.port_name,
                                                      wk_string)))
        if apple_additions():
            expectations.append(self._apple_baseline_path(self.port_name))
        expectations.append(self._webkit_baseline_path(self.port_name))

        for version in versions_to_fallback:
            apple_name = None
            if apple_additions():
                apple_name = VersionNameMap.map(self.host.platform).to_name(
                    version, platform=IOSPort.port_name, table=INTERNAL_TABLE)
            if apple_name:
                expectations.append(
                    self._apple_baseline_path('{}-{}'.format(
                        IOSPort.port_name,
                        apple_name.lower().replace(' ', ''))))
            expectations.append(
                self._webkit_baseline_path('{}-{}'.format(
                    IOSPort.port_name, version.major)))

        if apple_additions():
            expectations.append(
                self._apple_baseline_path('{}-{}'.format(
                    IOSPort.port_name, wk_string)))
        expectations.append(
            self._webkit_baseline_path('{}-{}'.format(IOSPort.port_name,
                                                      wk_string)))
        if apple_additions():
            expectations.append(self._apple_baseline_path(IOSPort.port_name))
        expectations.append(self._webkit_baseline_path(IOSPort.port_name))

        if self.get_option('webkit_test_runner'):
            expectations.append(self._webkit_baseline_path('wk2'))

        return expectations

    def test_expectations_file_position(self):
        return 4
Beispiel #16
0
 def booted_ios_devices_filter(device):
     if not device.platform_device.is_booted_or_booting():
         return False
     return device.platform_device.device_type in DeviceType(software_variant='iOS',
                                                             software_version=self.ios_version())
Beispiel #17
0
class IOSSimulatorPort(IOSPort):
    port_name = "ios-simulator"

    FUTURE_VERSION = 'future'
    ARCHITECTURES = ['x86_64', 'i386']
    DEFAULT_ARCHITECTURE = 'x86_64'

    DEVICE_MANAGER = SimulatedDeviceManager

    DEFAULT_DEVICE_TYPES = [
        DeviceType(hardware_family='iPhone', hardware_type='SE'),
        DeviceType(hardware_family='iPad', hardware_type='(5th generation)'),
        DeviceType(hardware_family='iPhone', hardware_type='7'),
    ]
    SDK = apple_additions().get_sdk('iphonesimulator') if apple_additions() else 'iphonesimulator'

    @staticmethod
    def _version_from_name(name):
        if len(name.split('-')) > 2 and name.split('-')[2].isdigit():
            return Version.from_string(name.split('-')[2])
        return None

    @memoized
    def device_version(self):
        if self.get_option('version'):
            return Version.from_string(self.get_option('version'))
        return IOSSimulatorPort._version_from_name(self._name) if IOSSimulatorPort._version_from_name(self._name) else self.host.platform.xcode_sdk_version('iphonesimulator')

    def clean_up_test_run(self):
        super(IOSSimulatorPort, self).clean_up_test_run()
        _log.debug("clean_up_test_run")

        SimulatedDeviceManager.tear_down(self.host)

    def environment_for_api_tests(self):
        no_prefix = super(IOSSimulatorPort, self).environment_for_api_tests()
        result = {}
        SIMCTL_ENV_PREFIX = 'SIMCTL_CHILD_'
        for value in no_prefix:
            if not value.startswith(SIMCTL_ENV_PREFIX):
                result[SIMCTL_ENV_PREFIX + value] = no_prefix[value]
            else:
                result[value] = no_prefix[value]
        return result

    def setup_environ_for_server(self, server_name=None):
        env = super(IOSSimulatorPort, self).setup_environ_for_server(server_name)
        if server_name == self.driver_name():
            if self.get_option('leaks'):
                env['MallocStackLogging'] = '1'
                env['__XPC_MallocStackLogging'] = '1'
                env['MallocScribble'] = '1'
                env['__XPC_MallocScribble'] = '1'
        return env

    def operating_system(self):
        return 'ios-simulator'

    def reset_preferences(self):
        _log.debug("reset_preferences")
        SimulatedDeviceManager.tear_down(self.host)

    @property
    @memoized
    def developer_dir(self):
        return self._executive.run_command(['xcode-select', '--print-path']).rstrip()

    def logging_patterns_to_strip(self):
        return []

    def stderr_patterns_to_strip(self):
        return []
    def test_available_devices(self):
        SimulatedDeviceTest.reset_simulated_device_manager()
        host = SimulatedDeviceTest.mock_host_for_simctl()
        SimulatedDeviceManager.available_devices(host)

        # There should only be 1 iPhone X, iPhone 8 and iPhone SE
        self.assertEquals(
            1,
            len(
                SimulatedDeviceManager.device_by_filter(
                    lambda device: device.device_type == DeviceType.
                    from_string('iPhone X'), host)))
        self.assertEquals(
            1,
            len(
                SimulatedDeviceManager.device_by_filter(
                    lambda device: device.device_type == DeviceType.
                    from_string('iPhone 8'), host)))

        # There should be 2 5s and 6s
        self.assertEquals(
            2,
            len(
                SimulatedDeviceManager.device_by_filter(
                    lambda device: device.device_type == DeviceType.
                    from_string('iPhone 5s'), host)))
        self.assertEquals(
            2,
            len(
                SimulatedDeviceManager.device_by_filter(
                    lambda device: device.device_type == DeviceType.
                    from_string('iPhone 6s'), host)))

        # 19 iPhones
        self.assertEquals(
            19,
            len(
                SimulatedDeviceManager.device_by_filter(
                    lambda device: device.device_type == DeviceType.
                    from_string('iPhone'), host)))

        # 11 iPads
        self.assertEquals(
            11,
            len(
                SimulatedDeviceManager.device_by_filter(
                    lambda device: device.device_type == DeviceType.
                    from_string('iPad'), host)))

        # 18 Apple watches
        self.assertEquals(
            6,
            len(
                SimulatedDeviceManager.device_by_filter(
                    lambda device: device.device_type == DeviceType.
                    from_string('Apple Watch'), host)))

        # 3 Apple TVs
        self.assertEquals(
            3,
            len(
                SimulatedDeviceManager.device_by_filter(
                    lambda device: device.device_type == DeviceType.
                    from_string('Apple TV'), host)))

        # 18 devices running iOS 11.0
        self.assertEquals(
            18,
            len(
                SimulatedDeviceManager.device_by_filter(
                    lambda device: device.device_type == DeviceType(
                        software_variant='iOS',
                        software_version=Version(11, 0, 1)), host)))

        # 11 iPhones running iOS 11.0
        self.assertEquals(
            11,
            len(
                SimulatedDeviceManager.device_by_filter(
                    lambda device: device.device_type == DeviceType(
                        hardware_family='iPhone',
                        software_version=Version(11, 0, 1)), host)))

        # 1 device running iOS 12
        self.assertEquals(
            1,
            len(
                SimulatedDeviceManager.device_by_filter(
                    lambda device: device.device_type == DeviceType(
                        software_variant='iOS',
                        software_version=Version(12, 0, 0)), host)))
Beispiel #19
0
class IOSPort(DevicePort):
    port_name = "ios"

    CURRENT_VERSION = Version(12)
    DEVICE_TYPE = DeviceType(software_variant='iOS')

    def __init__(self, host, port_name, **kwargs):
        super(IOSPort, self).__init__(host, port_name, **kwargs)
        self._test_runner_process_constructor = SimulatorProcess
        self._printing_cmd_line = False

    def version_name(self):
        if self._os_version is None:
            return None
        return VersionNameMap.map(self.host.platform).to_name(self._os_version, platform=IOSPort.port_name)

    def default_baseline_search_path(self, device_type=None):
        wk_string = 'wk1'
        if self.get_option('webkit_test_runner'):
            wk_string = 'wk2'

        versions_to_fallback = []
        if self.device_version().major == self.CURRENT_VERSION.major:
            versions_to_fallback = [self.CURRENT_VERSION]
        elif self.device_version():
            temp_version = Version(self.device_version().major)
            while temp_version != self.CURRENT_VERSION:
                versions_to_fallback.append(Version.from_iterable(temp_version))
                if temp_version < self.CURRENT_VERSION:
                    temp_version.major += 1
                else:
                    temp_version.major -= 1

        runtime_type = 'simulator' if 'simulator' in self.SDK else 'device'
        hardware_family = device_type.hardware_family.lower() if device_type and device_type.hardware_family else None
        hardware_type = device_type.hardware_type.lower() if device_type and device_type.hardware_type else None

        base_variants = []
        if hardware_family and hardware_type:
            base_variants.append('{}-{}-{}'.format(hardware_family, hardware_type, runtime_type))
        if hardware_family:
            base_variants.append('{}-{}'.format(hardware_family, runtime_type))
        base_variants.append('{}-{}'.format(IOSPort.port_name, runtime_type))
        if hardware_family and hardware_type:
            base_variants.append('{}-{}'.format(hardware_family, hardware_type))
        if hardware_family:
            base_variants.append(hardware_family)
        base_variants.append(IOSPort.port_name)

        expectations = []
        for variant in base_variants:
            for version in versions_to_fallback:
                apple_name = None
                if apple_additions():
                    apple_name = VersionNameMap.map(self.host.platform).to_name(version, platform=IOSPort.port_name, table=INTERNAL_TABLE)

                if apple_name:
                    expectations.append(self._apple_baseline_path('{}-{}-{}'.format(variant, apple_name.lower().replace(' ', ''), wk_string)))
                expectations.append(self._webkit_baseline_path('{}-{}-{}'.format(variant, version.major, wk_string)))
                if apple_name:
                    expectations.append(self._apple_baseline_path('{}-{}'.format(variant, apple_name.lower().replace(' ', ''))))
                expectations.append(self._webkit_baseline_path('{}-{}'.format(variant, version.major)))

            if apple_additions():
                expectations.append(self._apple_baseline_path('{}-{}'.format(variant, wk_string)))
            expectations.append(self._webkit_baseline_path('{}-{}'.format(variant, wk_string)))
            if apple_additions():
                expectations.append(self._apple_baseline_path(variant))
            expectations.append(self._webkit_baseline_path(variant))

        if self.get_option('webkit_test_runner'):
            expectations.append(self._webkit_baseline_path('wk2'))

        return expectations

    def test_expectations_file_position(self):
        return 5
Beispiel #20
0
        class MockCustomDevicePort(TestPort):
            CUSTOM_DEVICE_TYPES = [DeviceType(hardware_family='iPad')]

            def __init__(self, host):
                super(MockCustomDevicePort, self).__init__(host)