1 # Copyright 2018 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Top-level presubmit script for media/test/.
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into depot_tools.
11 def _CheckTestDataReadmeUpdated(input_api, output_api):
13 Checks to make sure the README.md file is updated when changing test files.
15 test_data_dir = input_api.os_path.join('media', 'test', 'data')
16 readme_path = input_api.os_path.join('media', 'test', 'data', 'README.md')
18 readme_updated = False
20 for f in input_api.AffectedFiles():
21 local_path = f.LocalPath()
22 if input_api.os_path.dirname(local_path) == test_data_dir:
24 if local_path == readme_path:
27 if test_files and not readme_updated:
28 errors.append(output_api.PresubmitPromptWarning(
29 'When updating files in ' + test_data_dir + ', please also update '
30 + readme_path + ':', test_files))
33 def CheckChangeOnUpload(input_api, output_api):
34 return _CheckTestDataReadmeUpdated(input_api, output_api)