| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Test runners for iOS.""" | 5 """Test runners for iOS.""" |
| 6 | 6 |
| 7 import argparse | 7 import argparse |
| 8 import collections | 8 import collections |
| 9 import errno | 9 import errno |
| 10 import os | 10 import os |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 def kill_simulators(): | 390 def kill_simulators(): |
| 391 """Kills all running simulators.""" | 391 """Kills all running simulators.""" |
| 392 try: | 392 try: |
| 393 subprocess.check_call([ | 393 subprocess.check_call([ |
| 394 'pkill', | 394 'pkill', |
| 395 '-9', | 395 '-9', |
| 396 '-x', | 396 '-x', |
| 397 # The simulator's name varies by Xcode version. | 397 # The simulator's name varies by Xcode version. |
| 398 'iPhone Simulator', # Xcode 5 | 398 'iPhone Simulator', # Xcode 5 |
| 399 'iOS Simulator', # Xcode 6 | 399 'iOS Simulator', # Xcode 6 |
| 400 'Simulator', # Xcode 7 | 400 'Simulator', # Xcode 7+ |
| 401 'simctl', # https://crbug.com/637429 |
| 401 ]) | 402 ]) |
| 402 except subprocess.CalledProcessError as e: | 403 except subprocess.CalledProcessError as e: |
| 403 if e.returncode != 1: | 404 if e.returncode != 1: |
| 404 # Ignore a 1 exit code (which means there were no simulators to kill). | 405 # Ignore a 1 exit code (which means there were no simulators to kill). |
| 405 raise | 406 raise |
| 406 | 407 |
| 407 def wipe_simulator(self): | 408 def wipe_simulator(self): |
| 408 """Wipes the simulator.""" | 409 """Wipes the simulator.""" |
| 409 subprocess.check_call([ | 410 subprocess.check_call([ |
| 410 self.iossim_path, | 411 self.iossim_path, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 A dict of environment variables. | 667 A dict of environment variables. |
| 667 """ | 668 """ |
| 668 env = super(DeviceTestRunner, self).get_launch_env() | 669 env = super(DeviceTestRunner, self).get_launch_env() |
| 669 if self.xctest_path: | 670 if self.xctest_path: |
| 670 # e.g. ios_web_shell_test_host | 671 # e.g. ios_web_shell_test_host |
| 671 env['APP_TARGET_NAME'] = ( | 672 env['APP_TARGET_NAME'] = ( |
| 672 os.path.splitext(os.path.basename(self.app_path))[0]) | 673 os.path.splitext(os.path.basename(self.app_path))[0]) |
| 673 # e.g. ios_web_shell_test | 674 # e.g. ios_web_shell_test |
| 674 env['TEST_TARGET_NAME'] = env['APP_TARGET_NAME'].rsplit('_', 1)[0] | 675 env['TEST_TARGET_NAME'] = env['APP_TARGET_NAME'].rsplit('_', 1)[0] |
| 675 return env | 676 return env |
| OLD | NEW |