Home | History | Annotate | Download | only in tld_cleanup
      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
      3 # found in the LICENSE file.
      4 
      5 
      6 """Chromium presubmit script for src/net/tools/tld_cleanup."""
      7 
      8 
      9 def _RunMakeDafsaTests(input_api, output_api):
     10   """Runs unittest for make_dafsa if any related file has been modified."""
     11   files = ('net/tools/tld_cleanup/make_dafsa.py',
     12            'net/tools/tld_cleanup/make_dafsa_unittest.py')
     13   if not any(f in input_api.LocalPaths() for f in files):
     14     return []
     15   test_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
     16                                      'make_dafsa_unittest.py')
     17   cmd_name = 'make_dafsa_unittest'
     18   cmd = [input_api.python_executable, test_path]
     19   test_cmd = input_api.Command(
     20     name=cmd_name,
     21     cmd=cmd,
     22     kwargs={},
     23     message=output_api.PresubmitPromptWarning)
     24   return input_api.RunTests([test_cmd])
     25 
     26 
     27 def CheckChangeOnUpload(input_api, output_api):
     28   return _RunMakeDafsaTests(input_api, output_api)
     29 
     30 
     31 def CheckChangeOnCommit(input_api, output_api):
     32   return _RunMakeDafsaTests(input_api, output_api)
     33