Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import difflib | 6 import difflib |
| 7 import os | 7 import os |
| 8 import re | 8 import re |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 def _ReadInputFile(self): | 137 def _ReadInputFile(self): |
| 138 return self._ReadTextFileContents("PRESUBMIT_test_old_file.txt") | 138 return self._ReadTextFileContents("PRESUBMIT_test_old_file.txt") |
| 139 | 139 |
| 140 def _PrepareTest(self, new_file_path): | 140 def _PrepareTest(self, new_file_path): |
| 141 old_contents = self._ReadInputFile() | 141 old_contents = self._ReadInputFile() |
| 142 if not new_file_path: | 142 if not new_file_path: |
| 143 new_contents = [] | 143 new_contents = [] |
| 144 else: | 144 else: |
| 145 new_contents = self._ReadTextFileContents(new_file_path) | 145 new_contents = self._ReadTextFileContents(new_file_path) |
| 146 input_api = MockInputApi() | 146 input_api = MockInputApi() |
| 147 mock_file = MockFile(PRESUBMIT.HistogramValueChecker.LOCAL_PATH, | 147 mock_file = MockFile(PRESUBMIT.HistogramValueChecker.HIST_VALUE_LOCAL_PATH, |
|
rpaquay
2014/02/18 21:39:26
Does this work? I am slightly confused to where HI
ahernandez
2014/02/20 17:23:42
It appears I forgot to remove this file; all of th
| |
| 148 old_contents, | 148 old_contents, |
| 149 new_contents) | 149 new_contents) |
| 150 input_api.files.append(mock_file) | 150 input_api.files.append(mock_file) |
| 151 output_api = MockOutputApi() | 151 output_api = MockOutputApi() |
| 152 return input_api, output_api | 152 return input_api, output_api |
| 153 | 153 |
| 154 def _RunTest(self, new_file_path): | 154 def _RunTest(self, new_file_path): |
| 155 input_api, output_api = self._PrepareTest(new_file_path) | 155 input_api, output_api = self._PrepareTest(new_file_path) |
| 156 checker = PRESUBMIT.HistogramValueChecker(input_api, output_api) | 156 checker = PRESUBMIT.HistogramValueChecker(input_api, output_api) |
| 157 results = checker.Run() | 157 results = checker.Run() |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 def testSingleValidDeleteOutsideOfEnum(self): | 222 def testSingleValidDeleteOutsideOfEnum(self): |
| 223 results = self._RunTest(self.TEST_FILE_PATTERN % "10") | 223 results = self._RunTest(self.TEST_FILE_PATTERN % "10") |
| 224 # TODO(rpaquay) How to check it's the expected warning?' | 224 # TODO(rpaquay) How to check it's the expected warning?' |
| 225 self.assertEquals(0, len(results), | 225 self.assertEquals(0, len(results), |
| 226 "We should not get a warning for a deletion outside of " | 226 "We should not get a warning for a deletion outside of " |
| 227 "the enum") | 227 "the enum") |
| 228 | 228 |
| 229 | 229 |
| 230 if __name__ == '__main__': | 230 if __name__ == '__main__': |
| 231 unittest.main() | 231 unittest.main() |
| OLD | NEW |