OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 '''Chromium presubmit script for fetch API layout tests. | 5 '''Chromium presubmit script for fetch API layout tests. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts. | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts. |
8 ''' | 8 ''' |
9 | 9 |
10 import os | 10 import os |
11 import os.path | 11 import os.path |
12 import re | 12 import re |
13 | 13 |
14 | 14 |
15 def missing_files(scripts_path, top_path, worker_path): | 15 def missing_files(scripts_path, top_path, worker_path): |
16 for script in os.listdir(scripts_path): | 16 for script in os.listdir(scripts_path): |
| 17 if script.startswith('.') or not script.endswith('.js'): |
| 18 continue |
17 basename = re.sub(r'\.js$', '.html', os.path.basename(script)) | 19 basename = re.sub(r'\.js$', '.html', os.path.basename(script)) |
18 window_path = os.path.join(top_path, basename) | 20 for path in [os.path.join(top_path, basename), |
19 worker_path = os.path.join(worker_path, basename) | 21 os.path.join(worker_path, basename)]: |
20 for path in [window_path, worker_path]: | |
21 if not os.path.exists(path): | 22 if not os.path.exists(path): |
22 yield path | 23 yield path |
23 | 24 |
24 | 25 |
25 def CheckChangeOnUpload(input, output): | 26 def CheckChangeOnUpload(input, output): |
26 top_path = input.PresubmitLocalPath() | 27 top_path = input.PresubmitLocalPath() |
27 worker_path = os.path.join(top_path, 'workers') | 28 worker_path = os.path.join(top_path, 'workers') |
28 script_tests_path = os.path.join(top_path, 'script-tests') | 29 script_tests_path = os.path.join(top_path, 'script-tests') |
29 | 30 |
30 return [output.PresubmitPromptWarning('%s is missing' % path) for path | 31 return [output.PresubmitPromptWarning('%s is missing' % path) for path |
31 in missing_files(script_tests_path, top_path, worker_path)] | 32 in missing_files(script_tests_path, top_path, worker_path)] |
OLD | NEW |