Chromium Code Reviews| Index: tools/telemetry/telemetry/core/platform/ios_device.py |
| diff --git a/tools/telemetry/telemetry/core/platform/ios_device.py b/tools/telemetry/telemetry/core/platform/ios_device.py |
| index 0cec05e7fdbadde5071a36e001a019494cc3b9f4..f093d245992382902994591ff2dc54dfcc5f9b36 100644 |
| --- a/tools/telemetry/telemetry/core/platform/ios_device.py |
| +++ b/tools/telemetry/telemetry/core/platform/ios_device.py |
| @@ -2,13 +2,21 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| +import os |
| import re |
| import subprocess |
| from telemetry.core import platform |
| from telemetry.core.platform import device |
| +from telemetry.util import path |
| +IOSSIM_BUILD_DIRECTORIES = [ |
| + 'Debug-iphonesimulator', |
| + 'Profile-iphonesimulator', |
| + 'Release-iphonesimulator' |
| +] |
| + |
| class IOSDevice(device.Device): |
| def __init__(self): |
| super(IOSDevice, self).__init__(name='ios', guid='ios') |
| @@ -25,6 +33,25 @@ def _IsIosDeviceAttached(): |
| return True |
| return False |
| +def _IsIosSimulatorAvailable(): |
| + """Determines whether an iOS simulator is present in the local checkout. |
| + |
| + Assumes the iOS simulator (iossim) and Chromium have already been built. |
| + |
| + Returns: |
| + True if at least one simulator is found, otherwise False. |
| + """ |
| + for build_dir in IOSSIM_BUILD_DIRECTORIES: |
| + iossim_path = os.path.join( |
| + path.GetChromiumSrcDir(), 'out', build_dir, 'iossim') |
|
nednguyen
2015/03/19 21:04:10
FYI, this won't work once telemetry is moved to gi
|
| + chromium_path = os.path.join( |
| + path.GetChromiumSrcDir(), 'out', build_dir, 'Chromium.app') |
| + |
| + # If the iOS simulator and Chromium app are present, return True |
| + if os.path.exists(iossim_path) and os.path.exists(chromium_path): |
| + return True |
| + |
| + return False |
| def FindAllAvailableDevices(_): |
| """Returns a list of available devices. |
| @@ -34,7 +61,7 @@ def FindAllAvailableDevices(_): |
| if platform.GetHostPlatform().GetOSName() != 'mac': |
| return [] |
| - if not _IsIosDeviceAttached(): |
| + if not _IsIosDeviceAttached() and not _IsIosSimulatorAvailable(): |
| return [] |
| - return [IOSDevice()] |
| + return [IOSDevice()] |