⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243770 in webkit


Ignore:
Timestamp:
Apr 2, 2019, 5:04:01 PM (7 years ago)
Author:
Kocsen Chung
Message:

Cherry-pick r239945. rdar://problem/49539128

webkitpy: Expose device_type from host-like objects
https://bugs.webkit.org/show_bug.cgi?id=193406
<rdar://problem/47262305>

Reviewed by Lucas Forschler.

Devices should expose device_type. As a result, all host objects should
provide a device_type property, even if they do not yet define a device_type.

  • Scripts/webkitpy/common/system/systemhost.py: (SystemHost): (SystemHost.device_type):
  • Scripts/webkitpy/common/system/systemhost_mock.py: (MockSystemHost): (MockSystemHost.device_type):
  • Scripts/webkitpy/port/device.py: (Device): (Device.device_type):
  • Scripts/webkitpy/xcode/simulated_device.py: (SimulatedDeviceManager._find_exisiting_device_for_request): (SimulatedDeviceManager._disambiguate_device_type): (SimulatedDeviceManager._does_fulfill_request): (SimulatedDeviceManager.device_count_for_type): (SimulatedDeviceManager.initialize_devices):
  • Scripts/webkitpy/xcode/simulated_device_unittest.py: (test_available_devices): (test_swapping_devices):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239945 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-607-branch/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/Tools/ChangeLog

    r243769 r243770  
     12019-04-02  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r239945. rdar://problem/49539128
     4
     5    webkitpy: Expose device_type from host-like objects
     6    https://bugs.webkit.org/show_bug.cgi?id=193406
     7    <rdar://problem/47262305>
     8   
     9    Reviewed by Lucas Forschler.
     10   
     11    Devices should expose device_type. As a result, all host objects should
     12    provide a device_type property, even if they do not yet define a device_type.
     13   
     14    * Scripts/webkitpy/common/system/systemhost.py:
     15    (SystemHost):
     16    (SystemHost.device_type):
     17    * Scripts/webkitpy/common/system/systemhost_mock.py:
     18    (MockSystemHost):
     19    (MockSystemHost.device_type):
     20    * Scripts/webkitpy/port/device.py:
     21    (Device):
     22    (Device.device_type):
     23    * Scripts/webkitpy/xcode/simulated_device.py:
     24    (SimulatedDeviceManager._find_exisiting_device_for_request):
     25    (SimulatedDeviceManager._disambiguate_device_type):
     26    (SimulatedDeviceManager._does_fulfill_request):
     27    (SimulatedDeviceManager.device_count_for_type):
     28    (SimulatedDeviceManager.initialize_devices):
     29    * Scripts/webkitpy/xcode/simulated_device_unittest.py:
     30    (test_available_devices):
     31    (test_swapping_devices):
     32   
     33    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239945 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     34
     35    2019-01-14  Jonathan Bedard  <jbedard@apple.com>
     36
     37            webkitpy: Expose device_type from host-like objects
     38            https://bugs.webkit.org/show_bug.cgi?id=193406
     39            <rdar://problem/47262305>
     40
     41            Reviewed by Lucas Forschler.
     42
     43            Devices should expose device_type. As a result, all host objects should
     44            provide a device_type property, even if they do not yet define a device_type.
     45
     46            * Scripts/webkitpy/common/system/systemhost.py:
     47            (SystemHost):
     48            (SystemHost.device_type):
     49            * Scripts/webkitpy/common/system/systemhost_mock.py:
     50            (MockSystemHost):
     51            (MockSystemHost.device_type):
     52            * Scripts/webkitpy/port/device.py:
     53            (Device):
     54            (Device.device_type):
     55            * Scripts/webkitpy/xcode/simulated_device.py:
     56            (SimulatedDeviceManager._find_exisiting_device_for_request):
     57            (SimulatedDeviceManager._disambiguate_device_type):
     58            (SimulatedDeviceManager._does_fulfill_request):
     59            (SimulatedDeviceManager.device_count_for_type):
     60            (SimulatedDeviceManager.initialize_devices):
     61            * Scripts/webkitpy/xcode/simulated_device_unittest.py:
     62            (test_available_devices):
     63            (test_swapping_devices):
     64
    1652019-04-02  Kocsen Chung  <kocsen_chung@apple.com>
    266
  • branches/safari-607-branch/Tools/Scripts/webkitpy/common/system/systemhost.py

    r233332 r243770  
    11# Copyright (c) 2011 Google Inc. All rights reserved.
     2# Copyright (C) 2019 Apple Inc. All rights reserved.
    23#
    34# Redistribution and use in source and binary forms, with or without
     
    5556            return ''
    5657        return self.executive.run_command(['xcrun', 'lldb', '--python-path'], return_stderr=False).rstrip()
     58
     59    @property
     60    def device_type(self):
     61        return None
  • branches/safari-607-branch/Tools/Scripts/webkitpy/common/system/systemhost_mock.py

    r217853 r243770  
    1     # Copyright (c) 2011 Google Inc. All rights reserved.
    2     #
    3     # Redistribution and use in source and binary forms, with or without
    4     # modification, are permitted provided that the following conditions are
    5     # met:
    6     #
    7     #     * Redistributions of source code must retain the above copyright
    8     # notice, this list of conditions and the following disclaimer.
    9     #     * Redistributions in binary form must reproduce the above
    10     # copyright notice, this list of conditions and the following disclaimer
    11     # in the documentation and/or other materials provided with the
    12     # distribution.
    13     #     * Neither the name of Google Inc. nor the names of its
    14     # contributors may be used to endorse or promote products derived from
    15     # this software without specific prior written permission.
    16     #
    17     # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    18     # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    19     # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    20     # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    21     # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    22     # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    23     # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    24     # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    25     # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    26     # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    27     # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     1# Copyright (c) 2011 Google Inc. All rights reserved.
     2# Copyright (C) 2019 Apple Inc. All rights reserved.
     3#
     4#  Redistribution and use in source and binary forms, with or without
     5# modification, are permitted provided that the following conditions are
     6# met:
     7#
     8#     * Redistributions of source code must retain the above copyright
     9# notice, this list of conditions and the following disclaimer.
     10#     * Redistributions in binary form must reproduce the above
     11# copyright notice, this list of conditions and the following disclaimer
     12# in the documentation and/or other materials provided with the
     13# distribution.
     14#     * Neither the name of Google Inc. nor the names of its
     15# contributors may be used to endorse or promote products derived from
     16# this software without specific prior written permission.
     17#
     18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     28# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2829
    2930from webkitpy.common.system.environment import Environment
     
    5859    def symbolicate_crash_log_if_needed(self, path):
    5960        return self.filesystem.read_text_file(path)
     61
     62    @property
     63    def device_type(self):
     64        return None
  • branches/safari-607-branch/Tools/Scripts/webkitpy/port/device.py

    r243748 r243770  
    1 # Copyright (C) 2017 Apple Inc. All rights reserved.
     1# Copyright (C) 2017-2019 Apple Inc. All rights reserved.
    22#
    33# Redistribution and use in source and binary forms, with or without
  • branches/safari-607-branch/Tools/Scripts/webkitpy/xcode/simulated_device.py

    r243748 r243770  
    1 # Copyright (C) 2017 Apple Inc. All rights reserved.
     1# Copyright (C) 2017-2019 Apple Inc. All rights reserved.
    22#
    33# Redistribution and use in source and binary forms, with or without
     
    177177                    device = None
    178178                    break
    179             if device and request.device_type == device.platform_device.device_type:
     179            if device and request.device_type == device.device_type:
    180180                return device
    181181        return None
     
    223223            # We use the existing devices to determine a legal family if no family is specified
    224224            for device in SimulatedDeviceManager.AVAILABLE_DEVICES:
    225                 if device.platform_device.device_type == full_device_type:
    226                     full_device_type.hardware_family = device.platform_device.device_type.hardware_family
     225                if device.device_type == full_device_type:
     226                    full_device_type.hardware_family = device.device_type.hardware_family
    227227                    break
    228228
     
    286286            if not request.use_booted_simulator:
    287287                continue
    288             if request.device_type == device.platform_device.device_type:
     288            if request.device_type == device.device_type:
    289289                _log.debug("The request for '{}' matched {} exactly".format(request.device_type, device))
    290290                return request
     
    294294            if not request.use_booted_simulator:
    295295                continue
    296             if device.platform_device.device_type in request.device_type:
     296            if device.device_type in request.device_type:
    297297                _log.debug("The request for '{}' fuzzy-matched {}".format(request.device_type, device))
    298298                return request
     
    307307            if not request.use_booted_simulator or not request.allow_incomplete_match:
    308308                continue
    309             if request.device_type.software_variant == device.platform_device.device_type.software_variant:
     309            if request.device_type.software_variant == device.device_type.software_variant:
    310310                _log.warn("The request for '{}' incomplete-matched {}".format(request.device_type, device))
    311311                _log.warn("This may cause unexpected behavior in code that expected the device type {}".format(request.device_type))
     
    342342
    343343        if SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.is_booted_or_booting(), host=host) and use_booted_simulator:
    344             filter = lambda device: device.platform_device.is_booted_or_booting() and device.platform_device.device_type in device_type
     344            filter = lambda device: device.platform_device.is_booted_or_booting() and device.device_type in device_type
    345345            return len(SimulatedDeviceManager.device_by_filter(filter, host=host))
    346346
     
    384384                if not request.use_booted_simulator:
    385385                    continue
    386                 if request.device_type != device.platform_device.device_type and not request.allow_incomplete_match:
     386                if request.device_type != device.device_type and not request.allow_incomplete_match:
    387387                    continue
    388                 if request.device_type.software_variant != device.platform_device.device_type.software_variant:
     388                if request.device_type.software_variant != device.device_type.software_variant:
    389389                    continue
    390390                requests.remove(request)
  • branches/safari-607-branch/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py

    r243748 r243770  
    1 # Copyright (C) 2017 Apple Inc. All rights reserved.
     1# Copyright (C) 2017-2019 Apple Inc. All rights reserved.
    22#
    33# Redistribution and use in source and binary forms, with or without
     
    569569
    570570        # There should only be 1 iPhone X, iPhone 8 and iPhone SE
    571         self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType.from_string('iPhone X'), host)))
    572         self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType.from_string('iPhone 8'), host)))
     571        self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone X'), host)))
     572        self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone 8'), host)))
    573573
    574574        # There should be 2 5s and 6s
    575         self.assertEquals(2, len(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType.from_string('iPhone 5s'), host)))
    576         self.assertEquals(2, len(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType.from_string('iPhone 6s'), host)))
     575        self.assertEquals(2, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone 5s'), host)))
     576        self.assertEquals(2, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone 6s'), host)))
    577577
    578578        # 19 iPhones
    579         self.assertEquals(19, len(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType.from_string('iPhone'), host)))
     579        self.assertEquals(19, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone'), host)))
    580580
    581581        # 11 iPads
    582         self.assertEquals(11, len(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType.from_string('iPad'), host)))
     582        self.assertEquals(11, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPad'), host)))
    583583
    584584        # 18 Apple watches
    585         self.assertEquals(6, len(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType.from_string('Apple Watch'), host)))
     585        self.assertEquals(6, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('Apple Watch'), host)))
    586586
    587587        # 3 Apple TVs
    588         self.assertEquals(3, len(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType.from_string('Apple TV'), host)))
     588        self.assertEquals(3, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('Apple TV'), host)))
    589589
    590590        # 18 devices running iOS 11.0
    591         self.assertEquals(18, len(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType(software_variant='iOS', software_version=Version(11, 0, 1)), host)))
     591        self.assertEquals(18, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType(software_variant='iOS', software_version=Version(11, 0, 1)), host)))
    592592
    593593        # 11 iPhones running iOS 11.0
    594         self.assertEquals(11, len(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType(hardware_family='iPhone', software_version=Version(11, 0, 1)), host)))
     594        self.assertEquals(11, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType(hardware_family='iPhone', software_version=Version(11, 0, 1)), host)))
    595595
    596596        # 1 device running iOS 12
    597         self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType(software_variant='iOS', software_version=Version(12, 0, 0)), host)))
     597        self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType(software_variant='iOS', software_version=Version(12, 0, 0)), host)))
    598598
    599599    def test_existing_simulator(self):
     
    642642
    643643        # We won't test the creation and deletion of simulators, only managing existing sims
    644         SimulatedDeviceTest.change_state_to(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType.from_string('iPhone 8'), host)[0], SimulatedDevice.DeviceState.BOOTED)
    645         SimulatedDeviceTest.change_state_to(SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.device_type == DeviceType.from_string('iPhone X'), host)[0], SimulatedDevice.DeviceState.BOOTED)
     644        SimulatedDeviceTest.change_state_to(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone 8'), host)[0], SimulatedDevice.DeviceState.BOOTED)
     645        SimulatedDeviceTest.change_state_to(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone X'), host)[0], SimulatedDevice.DeviceState.BOOTED)
    646646
    647647        SimulatedDeviceManager.initialize_devices(DeviceRequest(DeviceType.from_string('iPhone 8')), host=host)
Note: See TracChangeset for help on using the changeset viewer.