
UNIT_TESTS = [
  'tests.perf_expectations_unittest',
]

PERF_EXPECTATIONS = 'perf_expectations.json'

def CheckChangeOnUpload(input_api, output_api):
  run_tests = False
  for path in input_api.LocalPaths():
    if PERF_EXPECTATIONS == input_api.os_path.basename(path):
      run_tests = True

  output = []
  if run_tests:
    output.extend(input_api.canned_checks.RunPythonUnitTests(input_api,
                                                             output_api,
                                                             UNIT_TESTS))
  return output


def CheckChangeOnCommit(input_api, output_api):
  run_tests = False
  for path in input_api.LocalPaths():
    if PERF_EXPECTATIONS == input_api.os_path.basename(path):
      run_tests = True

  output = []
  if run_tests:
    output.extend(input_api.canned_checks.RunPythonUnitTests(input_api,
                                                             output_api,
                                                             UNIT_TESTS))
    output.extend(input_api.canned_checks.CheckDoNotSubmit(input_api,
                                                           output_api))
  return output


UNIT_TESTS = [
  'tests.perf_expectations_unittest',
]

PERF_EXPECTATIONS = 'tools/perf_expectations/perf_expectations.json'

def CheckChangeOnUpload(input_api, output_api):
  run_tests = False
  for path in input_api.LocalPaths():
    if PERF_EXPECTATIONS == path:
      run_tests = True

  output = []
  if run_tests:
    output.extend(input_api.canned_checks.RunPythonUnitTests(input_api,
                                                             output_api,
                                                             UNIT_TESTS))
  return output


def CheckChangeOnCommit(input_api, output_api):
  run_tests = False
  for path in input_api.LocalPaths():
    if PERF_EXPECTATIONS == path:
      run_tests = True

  output = []
  if run_tests:
    output.extend(input_api.canned_checks.RunPythonUnitTests(input_api,
                                                             output_api,
                                                             UNIT_TESTS))
    output.extend(input_api.canned_checks.CheckDoNotSubmit(input_api,
                                                           output_api))
  return output

Use full pathname to perf_expectations in test.
Use full pathname to perf_expectations in test.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/266055

git-svn-id: http://src.chromium.org/svn/trunk/src@28770 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: f9d8e0a8dae19e482d3c435a76b4e38403e646b5
  
  UNIT_TESTS = [
    'tests.perf_expectations_unittest',
  ]
  
- PERF_EXPECTATIONS = 'perf_expectations.json'
+ PERF_EXPECTATIONS = 'tools/perf_expectations/perf_expectations.json'
  
  def CheckChangeOnUpload(input_api, output_api):
    run_tests = False
    for path in input_api.LocalPaths():
-     if PERF_EXPECTATIONS == input_api.os_path.basename(path):
+     if PERF_EXPECTATIONS == path:
        run_tests = True
  
    output = []
    if run_tests:
      output.extend(input_api.canned_checks.RunPythonUnitTests(input_api,
                                                               output_api,
                                                               UNIT_TESTS))
    return output
  
  
  def CheckChangeOnCommit(input_api, output_api):
    run_tests = False
    for path in input_api.LocalPaths():
-     if PERF_EXPECTATIONS == input_api.os_path.basename(path):
+     if PERF_EXPECTATIONS == path:
        run_tests = True
  
    output = []
    if run_tests:
      output.extend(input_api.canned_checks.RunPythonUnitTests(input_api,
                                                               output_api,
                                                               UNIT_TESTS))
      output.extend(input_api.canned_checks.CheckDoNotSubmit(input_api,
                                                             output_api))
    return output
  
Use full pathname to perf_expectations in test.
## Code Before:

UNIT_TESTS = [
  'tests.perf_expectations_unittest',
]

PERF_EXPECTATIONS = 'perf_expectations.json'

def CheckChangeOnUpload(input_api, output_api):
  run_tests = False
  for path in input_api.LocalPaths():
    if PERF_EXPECTATIONS == input_api.os_path.basename(path):
      run_tests = True

  output = []
  if run_tests:
    output.extend(input_api.canned_checks.RunPythonUnitTests(input_api,
                                                             output_api,
                                                             UNIT_TESTS))
  return output


def CheckChangeOnCommit(input_api, output_api):
  run_tests = False
  for path in input_api.LocalPaths():
    if PERF_EXPECTATIONS == input_api.os_path.basename(path):
      run_tests = True

  output = []
  if run_tests:
    output.extend(input_api.canned_checks.RunPythonUnitTests(input_api,
                                                             output_api,
                                                             UNIT_TESTS))
    output.extend(input_api.canned_checks.CheckDoNotSubmit(input_api,
                                                           output_api))
  return output

## Instruction:
Use full pathname to perf_expectations in test.
## Code After:

UNIT_TESTS = [
  'tests.perf_expectations_unittest',
]

PERF_EXPECTATIONS = 'tools/perf_expectations/perf_expectations.json'

def CheckChangeOnUpload(input_api, output_api):
  run_tests = False
  for path in input_api.LocalPaths():
    if PERF_EXPECTATIONS == path:
      run_tests = True

  output = []
  if run_tests:
    output.extend(input_api.canned_checks.RunPythonUnitTests(input_api,
                                                             output_api,
                                                             UNIT_TESTS))
  return output


def CheckChangeOnCommit(input_api, output_api):
  run_tests = False
  for path in input_api.LocalPaths():
    if PERF_EXPECTATIONS == path:
      run_tests = True

  output = []
  if run_tests:
    output.extend(input_api.canned_checks.RunPythonUnitTests(input_api,
                                                             output_api,
                                                             UNIT_TESTS))
    output.extend(input_api.canned_checks.CheckDoNotSubmit(input_api,
                                                           output_api))
  return output
