@@ -0,0 +1,1644 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0A%22%22%22Presubmit script for changes affecting web_page_replay_go/.%0A%0ASee http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts%0Afor more details about the presubmit API built into depot_tools.%0A%22%22%22%0A%0Adef _RunArgs(args, input_api, cwd):%0A  p = input_api.subprocess.Popen(args, stdout=input_api.subprocess.PIPE,%0A                                 stderr=input_api.subprocess.STDOUT,%0A                                 cwd=cwd)%0A  out, _ = p.communicate()%0A  return (out, p.returncode)%0A%0A%0Adef _CommonChecks(input_api, output_api):%0A  %22%22%22Performs common checks.%22%22%22%0A  results = %5B%5D%0A  if input_api.subprocess.call(%0A          %22go  version%22,%0A          shell=True,%0A          stdout=input_api.subprocess.PIPE,%0A          stderr=input_api.subprocess.PIPE) != 0:%0A    results.append(output_api.PresubmitPromptOrNotify(%0A        'go binary is not found. Make sure to run unit tests if you change any '%0A        'Go files.'))%0A    return results%0A  wpr_dir = input_api.PresubmitLocalPath()%0A  cmd = %5B'go', 'test', 'webpagereplay'%5D%0A  out, return_code = _RunArgs(cmd, input_api, wpr_dir)%0A  if return_code:%0A    results.append(output_api.PresubmitError(%0A        'webpagereplay tests failed.', long_text=out))%0A  print out%0A  return results%0A%0A%0Adef CheckChangeOnUpload(input_api, output_api):%0A  report = %5B%5D%0A  report.extend(_CommonChecks(input_api, output_api))%0A  return report%0A%0A%0Adef CheckChangeOnCommit(input_api, output_api):%0A  report = %5B%5D%0A  report.extend(_CommonChecks(input_api, output_api))%0A  return report%0A

Add a presubmit script to run tests