OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import re | 6 import re |
7 import shutil | 7 import shutil |
8 import sys | 8 import sys |
9 import unittest | 9 import unittest |
10 | 10 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 self.assertIsNone(results.error) | 363 self.assertIsNone(results.error) |
364 | 364 |
365 @mock.patch('urllib2.urlopen') | 365 @mock.patch('urllib2.urlopen') |
366 def testBisectResultsPosted(self, mock_urlopen): | 366 def testBisectResultsPosted(self, mock_urlopen): |
367 options_dict = dict(DEFAULT_OPTIONS) | 367 options_dict = dict(DEFAULT_OPTIONS) |
368 options_dict.update({ | 368 options_dict.update({ |
369 'bisect_mode': bisect_utils.BISECT_MODE_MEAN, | 369 'bisect_mode': bisect_utils.BISECT_MODE_MEAN, |
370 'try_job_id': 1234, | 370 'try_job_id': 1234, |
371 }) | 371 }) |
372 opts = bisect_perf_regression.BisectOptions.FromDict(options_dict) | 372 opts = bisect_perf_regression.BisectOptions.FromDict(options_dict) |
| 373 bisect_instance = _GetBisectPerformanceMetricsInstance(options_dict) |
373 results = _SampleBisecResult(opts) | 374 results = _SampleBisecResult(opts) |
374 bisect_perf_regression._PostBisectResults(results, opts, os.getcwd()) | 375 bisect_instance.PostBisectResults(results) |
375 | 376 |
376 call_args = _GetMockCallArg(mock_urlopen, 0) | 377 call_args = _GetMockCallArg(mock_urlopen, 0) |
377 self.assertIsNotNone(call_args) | 378 self.assertIsNotNone(call_args) |
378 self.assertIn('"try_job_id": 1234', call_args[1]) | 379 self.assertIn('"try_job_id": 1234', call_args[1]) |
379 | 380 |
380 def _CheckAbortsEarly(self, results, **extra_opts): | 381 def _CheckAbortsEarly(self, results, **extra_opts): |
381 """Returns True if the bisect job would abort early.""" | 382 """Returns True if the bisect job would abort early.""" |
382 global _MockResultsGenerator | 383 global _MockResultsGenerator |
383 _MockResultsGenerator = (r for r in results) | 384 _MockResultsGenerator = (r for r in results) |
384 bisect_class = bisect_perf_regression.BisectPerformanceMetrics | 385 bisect_class = bisect_perf_regression.BisectPerformanceMetrics |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 (None, 0)), | 746 (None, 0)), |
746 ] | 747 ] |
747 self._SetupRunGitMock(try_cmd) | 748 self._SetupRunGitMock(try_cmd) |
748 bisect_perf_regression._StartBuilderTryJob( | 749 bisect_perf_regression._StartBuilderTryJob( |
749 fetch_build.PERF_BUILDER, git_revision, bot_name, bisect_job_name, | 750 fetch_build.PERF_BUILDER, git_revision, bot_name, bisect_job_name, |
750 patch) | 751 patch) |
751 | 752 |
752 | 753 |
753 if __name__ == '__main__': | 754 if __name__ == '__main__': |
754 unittest.main() | 755 unittest.main() |
OLD | NEW |