| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 from collections import defaultdict | 5 from collections import defaultdict |
| 6 import copy | 6 import copy |
| 7 | 7 |
| 8 from common.dependency import Dependency | 8 from common.dependency import Dependency |
| 9 from common.dependency import DependencyRoll | 9 from common.dependency import DependencyRoll |
| 10 from common import chrome_dependency_fetcher | 10 from common import chrome_dependency_fetcher |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 # revision_range (even if the versions therein are None), because | 100 # revision_range (even if the versions therein are None), because |
| 101 # ChangelistClassifier.__call__ will take it apart in order to call | 101 # ChangelistClassifier.__call__ will take it apart in order to call |
| 102 # GetDEPSRollsDict; if it can't then it will immediately return the | 102 # GetDEPSRollsDict; if it can't then it will immediately return the |
| 103 # empty list of results, breaking many of the tests here. Of course, | 103 # empty list of results, breaking many of the tests here. Of course, |
| 104 # taking revision_range apart isn't actually required for the tests, | 104 # taking revision_range apart isn't actually required for the tests, |
| 105 # since we mock GetDEPSRollsDict. So, really what we ought to do in the | 105 # since we mock GetDEPSRollsDict. So, really what we ought to do in the |
| 106 # long run is redesign things so that GetDEPSRollsDict takes the | 106 # long run is redesign things so that GetDEPSRollsDict takes the |
| 107 # CrashReport directly and pulls out the revision_range and platform | 107 # CrashReport directly and pulls out the revision_range and platform |
| 108 # itself; that way ChangelistClassifier.__call__ needn't worry about it, | 108 # itself; that way ChangelistClassifier.__call__ needn't worry about it, |
| 109 # allowing us to clean up the tests here. | 109 # allowing us to clean up the tests here. |
| 110 # TODO(wrengr): this empty stacktrace causes the unittests to emit |
| 111 # logging warnings about the fact that we can't get the crash_stack. Would |
| 112 # be nice to avoid that. |
| 110 DUMMY_REPORT = CrashReport(None, None, None, Stacktrace(), (None, None)) | 113 DUMMY_REPORT = CrashReport(None, None, None, Stacktrace(), (None, None)) |
| 111 | 114 |
| 112 class ChangelistClassifierTest(CrashTestSuite): | 115 class ChangelistClassifierTest(CrashTestSuite): |
| 113 | 116 |
| 114 def setUp(self): | 117 def setUp(self): |
| 115 super(ChangelistClassifierTest, self).setUp() | 118 super(ChangelistClassifierTest, self).setUp() |
| 116 self.changelist_classifier = changelist_classifier.ChangelistClassifier( | 119 self.changelist_classifier = changelist_classifier.ChangelistClassifier( |
| 117 GitilesRepository(self.GetMockHttpClient()), 7) | 120 GitilesRepository(self.GetMockHttpClient()), 7) |
| 118 | 121 |
| 119 def testSkipAddedAndDeletedRegressionRolls(self): | 122 def testSkipAddedAndDeletedRegressionRolls(self): |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 return [match_result1, match_result2] | 468 return [match_result1, match_result2] |
| 466 | 469 |
| 467 self.mock(changelist_classifier, 'FindMatchResults', _MockFindMatchResults) | 470 self.mock(changelist_classifier, 'FindMatchResults', _MockFindMatchResults) |
| 468 self.mock(chrome_dependency_fetcher.ChromeDependencyFetcher, | 471 self.mock(chrome_dependency_fetcher.ChromeDependencyFetcher, |
| 469 'GetDependencyRollsDict', | 472 'GetDependencyRollsDict', |
| 470 lambda *_: {'src/': DependencyRoll('src/', 'https://repo', '1', '2')}) | 473 lambda *_: {'src/': DependencyRoll('src/', 'https://repo', '1', '2')}) |
| 471 self.mock(chrome_dependency_fetcher.ChromeDependencyFetcher, | 474 self.mock(chrome_dependency_fetcher.ChromeDependencyFetcher, |
| 472 'GetDependency', lambda *_: {}) | 475 'GetDependency', lambda *_: {}) |
| 473 | 476 |
| 474 self.assertListEqual(self.changelist_classifier(DUMMY_REPORT), []) | 477 self.assertListEqual(self.changelist_classifier(DUMMY_REPORT), []) |
| OLD | NEW |