OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 import datetime | 5 import datetime |
6 import glob | 6 import glob |
7 import heapq | 7 import heapq |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import os.path | 10 import os.path |
(...skipping 28 matching lines...) Expand all Loading... |
39 if os_name == 'mac': | 39 if os_name == 'mac': |
40 version_dir = os.path.join(os.path.dirname(executable), | 40 version_dir = os.path.join(os.path.dirname(executable), |
41 '..', | 41 '..', |
42 'Versions') | 42 'Versions') |
43 for version_num in os.listdir(version_dir): | 43 for version_num in os.listdir(version_dir): |
44 framework_file = os.path.join(version_dir, | 44 framework_file = os.path.join(version_dir, |
45 version_num, | 45 version_num, |
46 'Chromium Framework.framework', | 46 'Chromium Framework.framework', |
47 'Chromium Framework') | 47 'Chromium Framework') |
48 if os.path.isfile(framework_file): | 48 if os.path.isfile(framework_file): |
49 return framework_file | 49 # Sometimes dyld returns symbols for a different file. Emulate what it |
| 50 # does here by using the same mechanism to find the binary file. |
| 51 import fcntl |
| 52 F_GETPATH = 50 |
| 53 with open(framework_file, 'rb') as f: |
| 54 return fcntl.fcntl(f.fileno(), F_GETPATH, b'\0' * 1024).rstrip(b'\0') |
50 | 55 |
51 return executable | 56 return executable |
52 | 57 |
53 | 58 |
54 class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend): | 59 class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend): |
55 """The backend for controlling a locally-executed browser instance, on Linux, | 60 """The backend for controlling a locally-executed browser instance, on Linux, |
56 Mac or Windows. | 61 Mac or Windows. |
57 """ | 62 """ |
58 def __init__(self, desktop_platform_backend, browser_options, executable, | 63 def __init__(self, desktop_platform_backend, browser_options, executable, |
59 flash_path, is_content_shell, browser_directory, | 64 flash_path, is_content_shell, browser_directory, |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 self._tmp_profile_dir) | 566 self._tmp_profile_dir) |
562 else: | 567 else: |
563 # If we don't need the profile after the run then cleanup. | 568 # If we don't need the profile after the run then cleanup. |
564 if self._tmp_profile_dir and os.path.exists(self._tmp_profile_dir): | 569 if self._tmp_profile_dir and os.path.exists(self._tmp_profile_dir): |
565 shutil.rmtree(self._tmp_profile_dir, ignore_errors=True) | 570 shutil.rmtree(self._tmp_profile_dir, ignore_errors=True) |
566 self._tmp_profile_dir = None | 571 self._tmp_profile_dir = None |
567 | 572 |
568 if self._tmp_output_file: | 573 if self._tmp_output_file: |
569 self._tmp_output_file.close() | 574 self._tmp_output_file.close() |
570 self._tmp_output_file = None | 575 self._tmp_output_file = None |
OLD | NEW |