| OLD | NEW |
| 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 1 # Copyright (C) 2013 Adobe Systems Incorporated. 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 | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # | 6 # |
| 7 # 1. Redistributions of source code must retain the above | 7 # 1. Redistributions of source code must retain the above |
| 8 # copyright notice, this list of conditions and the following | 8 # copyright notice, this list of conditions and the following |
| 9 # disclaimer. | 9 # disclaimer. |
| 10 # 2. Redistributions in binary form must reproduce the above | 10 # 2. Redistributions in binary form must reproduce the above |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 from webkitpy.common.host import Host | 32 from webkitpy.common.host import Host |
| 33 from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup | 33 from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup |
| 34 | 34 |
| 35 | 35 |
| 36 _log = logging.getLogger(__name__) | 36 _log = logging.getLogger(__name__) |
| 37 | 37 |
| 38 | 38 |
| 39 class TestParser(object): | 39 class TestParser(object): |
| 40 | 40 |
| 41 def __init__(self, filename, options=None): | 41 def __init__(self, filename, host, options=None): |
| 42 self.options = options or {'all': False} | 42 self.options = options or {'all': False} |
| 43 self.filename = filename | 43 self.filename = filename |
| 44 self.host = Host() | 44 self.host = host |
| 45 self.filesystem = self.host.filesystem | 45 self.filesystem = self.host.filesystem |
| 46 | 46 |
| 47 self.test_doc = None | 47 self.test_doc = None |
| 48 self.ref_doc = None | 48 self.ref_doc = None |
| 49 self.load_file(filename) | 49 self.load_file(filename) |
| 50 | 50 |
| 51 def load_file(self, filename, is_ref=False): | 51 def load_file(self, filename, is_ref=False): |
| 52 if self.filesystem.isfile(filename): | 52 if self.filesystem.isfile(filename): |
| 53 try: | 53 try: |
| 54 doc = BeautifulSoup(self.filesystem.read_binary_file(filename)) | 54 doc = BeautifulSoup(self.filesystem.read_binary_file(filename)) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 href_paths = [href_tag['href'] for href_tag in elements_with_href_attrib
utes] | 156 href_paths = [href_tag['href'] for href_tag in elements_with_href_attrib
utes] |
| 157 | 157 |
| 158 paths = src_paths + href_paths + urls | 158 paths = src_paths + href_paths + urls |
| 159 for path in paths: | 159 for path in paths: |
| 160 if not path.startswith('http:') and not path.startswith('mailto:'): | 160 if not path.startswith('http:') and not path.startswith('mailto:'): |
| 161 uri_scheme_pattern = re.compile(r'[A-Za-z][A-Za-z+.-]*:') | 161 uri_scheme_pattern = re.compile(r'[A-Za-z][A-Za-z+.-]*:') |
| 162 if not uri_scheme_pattern.match(path): | 162 if not uri_scheme_pattern.match(path): |
| 163 support_files.append(path) | 163 support_files.append(path) |
| 164 | 164 |
| 165 return support_files | 165 return support_files |
| OLD | NEW |