| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 """Windows implementation of the Port interface.""" | 29 """Windows implementation of the Port interface.""" |
| 30 | 30 |
| 31 import errno | 31 import errno |
| 32 import logging | 32 import logging |
| 33 | 33 |
| 34 # The _winreg library is only available on Windows. |
| 35 # https://docs.python.org/2/library/_winreg.html |
| 34 try: | 36 try: |
| 35 import _winreg | 37 import _winreg # pylint: disable=import-error |
| 36 except ImportError as e: | 38 except ImportError: |
| 37 _winreg = None | 39 _winreg = None # pylint: disable=invalid-name |
| 38 WindowsError = Exception # this shuts up pylint. | |
| 39 | 40 |
| 40 from webkitpy.layout_tests.breakpad.dump_reader_win import DumpReaderWin | 41 from webkitpy.layout_tests.breakpad.dump_reader_win import DumpReaderWin |
| 41 from webkitpy.layout_tests.models import test_run_results | 42 from webkitpy.layout_tests.models import test_run_results |
| 42 from webkitpy.layout_tests.port import base | 43 from webkitpy.layout_tests.port import base |
| 43 from webkitpy.layout_tests.servers import crash_service | 44 from webkitpy.layout_tests.servers import crash_service |
| 44 | 45 |
| 45 | 46 |
| 46 _log = logging.getLogger(__name__) | 47 _log = logging.getLogger(__name__) |
| 47 | 48 |
| 48 | 49 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 # overriding the former), so reading from HKCR ensures that we get | 114 # overriding the former), so reading from HKCR ensures that we get |
| 114 # the value if it is set in either place. See als comments below. | 115 # the value if it is set in either place. See als comments below. |
| 115 hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, sub_key) | 116 hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, sub_key) |
| 116 args = _winreg.QueryValue(hkey, '').split() | 117 args = _winreg.QueryValue(hkey, '').split() |
| 117 _winreg.CloseKey(hkey) | 118 _winreg.CloseKey(hkey) |
| 118 | 119 |
| 119 # In order to keep multiple checkouts from stepping on each other, w
e simply check that an | 120 # In order to keep multiple checkouts from stepping on each other, w
e simply check that an |
| 120 # existing entry points to a valid path and has the right command li
ne. | 121 # existing entry points to a valid path and has the right command li
ne. |
| 121 if len(args) == 2 and self._filesystem.exists(args[0]) and args[0].e
ndswith('perl.exe') and args[1] == '-wT': | 122 if len(args) == 2 and self._filesystem.exists(args[0]) and args[0].e
ndswith('perl.exe') and args[1] == '-wT': |
| 122 return True | 123 return True |
| 123 except WindowsError as e: | 124 except WindowsError as error: # WindowsError is not defined on non-Wind
ows platforms - pylint: disable=undefined-variable |
| 124 if e.errno != errno.ENOENT: | 125 if error.errno != errno.ENOENT: |
| 125 raise e | 126 raise |
| 126 # The key simply probably doesn't exist. | 127 # The key simply probably doesn't exist. |
| 127 | 128 |
| 128 # Note that we write to HKCU so that we don't need privileged access | 129 # Note that we write to HKCU so that we don't need privileged access |
| 129 # to the registry, and that will get reflected in HKCR when it is read,
above. | 130 # to the registry, and that will get reflected in HKCR when it is read,
above. |
| 130 cmdline = self.path_from_chromium_base('third_party', 'perl', 'perl', 'b
in', 'perl.exe') + ' -wT' | 131 cmdline = self.path_from_chromium_base('third_party', 'perl', 'perl', 'b
in', 'perl.exe') + ' -wT' |
| 131 hkey = _winreg.CreateKeyEx(_winreg.HKEY_CURRENT_USER, 'Software\\Classes
\\' + sub_key, 0, _winreg.KEY_WRITE) | 132 hkey = _winreg.CreateKeyEx(_winreg.HKEY_CURRENT_USER, 'Software\\Classes
\\' + sub_key, 0, _winreg.KEY_WRITE) |
| 132 _winreg.SetValue(hkey, '', _winreg.REG_SZ, cmdline) | 133 _winreg.SetValue(hkey, '', _winreg.REG_SZ, cmdline) |
| 133 _winreg.CloseKey(hkey) | 134 _winreg.CloseKey(hkey) |
| 134 return True | 135 return True |
| 135 | 136 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 return result | 243 return result |
| 243 | 244 |
| 244 def look_for_new_crash_logs(self, crashed_processes, start_time): | 245 def look_for_new_crash_logs(self, crashed_processes, start_time): |
| 245 if self.get_option('disable_breakpad'): | 246 if self.get_option('disable_breakpad'): |
| 246 return None | 247 return None |
| 247 return self._dump_reader.look_for_new_crash_logs(crashed_processes, star
t_time) | 248 return self._dump_reader.look_for_new_crash_logs(crashed_processes, star
t_time) |
| 248 | 249 |
| 249 def clobber_old_port_specific_results(self): | 250 def clobber_old_port_specific_results(self): |
| 250 if not self.get_option('disable_breakpad'): | 251 if not self.get_option('disable_breakpad'): |
| 251 self._dump_reader.clobber_old_results() | 252 self._dump_reader.clobber_old_results() |
| OLD | NEW |