Commit 3662aebf authored by bustamante's avatar bustamante Committed by Commit bot

Detect iOS simulator as an iOS test device.

If on a MacOS machine, iossim and Chromium.app are built than we can
launch and use them for running tests.

BUG=468565

Review URL: https://codereview.chromium.org/1015313002

Cr-Commit-Position: refs/heads/master@{#321423}
parent 2ec85f60
......@@ -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')
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()]
\ No newline at end of file
return [IOSDevice()]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment