Index: Tools/GardeningServer/ui/test/ct-failure-analyzer-tests.html |
diff --git a/Tools/GardeningServer/ui/test/ct-failure-analyzer-tests.html b/Tools/GardeningServer/ui/test/ct-failure-analyzer-tests.html |
index 04ffced4aa182f4ca97ce2b619fd52defef0b523..996c9da9b69a83749406a9c81926a7801f8c60bf 100644 |
--- a/Tools/GardeningServer/ui/test/ct-failure-analyzer-tests.html |
+++ b/Tools/GardeningServer/ui/test/ct-failure-analyzer-tests.html |
@@ -30,45 +30,36 @@ describe('ct-failure-analyzer', function() { |
describe('_failureListComparator', function() { |
it('should compare failures correctly', function() { |
var analyzer = document.createElement('ct-failure-analyzer'); |
- var revision1 = { |
- 'chromium': 1, |
- 'blink': 2 |
- }; |
- var revision2 = { |
- 'chromium': 2, |
- 'blink': 1 |
- }; |
- var revision3 = { |
- 'chromium': 2, |
- 'blink': 2 |
- }; |
- var resultsByBuilder = {}; |
- var failure1 = new CTFailure("step", "reason", resultsByBuilder, revision1, revision1); |
- var failure2 = new CTFailure("step", "reason", resultsByBuilder, revision2, revision2); |
- var failure3 = new CTFailure("step", "reason", resultsByBuilder, revision3, revision3); |
- var failure4 = new CTFailure("step", "reason", resultsByBuilder, null, null); |
- var group1 = new CTFailureGroup("0", [failure1], null); |
- var group2 = new CTFailureGroup("1", [failure2], null); |
- var group3 = new CTFailureGroup("2", [failure3], null); |
- var group4 = new CTFailureGroup("3", [failure4], null); |
+ |
+ var group1 = new CTFailureGroup("0", [], ['chromium:1', 'blink:2'], null); |
+ var group2 = new CTFailureGroup("1", [], ['chromium:2', 'blink:1'], null); |
+ var group3 = new CTFailureGroup("2", [], ['chromium:2', 'blink:2'], null); |
+ var group4 = new CTFailureGroup("3", [], [], null); |
// Sort by last revision first. |
- assert(analyzer._failureListComparator('chromium', group1, group2) > 0); |
- assert(analyzer._failureListComparator('chromium', group2, group1) < 0); |
- assert(analyzer._failureListComparator('chromium', group1, group1) == 0); |
+ assert(analyzer._failureByTreeListComparator('chromium', group1, group2) > 0); |
+ assert(analyzer._failureByTreeListComparator('chromium', group2, group1) < 0); |
+ assert(analyzer._failureByTreeListComparator('chromium', group1, group1) == 0); |
// If the tree revisions are equal, take others. |
- assert(analyzer._failureListComparator('chromium', group2, group3) > 0); |
+ assert(analyzer._failureByTreeListComparator('chromium', group2, group3) > 0); |
// Prioritize the given tree. |
- assert(analyzer._failureListComparator('chromium', group1, group2) > 0); |
- assert(analyzer._failureListComparator('blink', group1, group2) < 0); |
+ assert(analyzer._failureByTreeListComparator('chromium', group1, group2) > 0); |
+ assert(analyzer._failureByTreeListComparator('blink', group1, group2) < 0); |
// Default to 'chromium'. |
- assert(analyzer._failureListComparator(undefined, group1, group2) > 0); |
+ assert(analyzer._failureByTreeListComparator(undefined, group1, group2) > 0); |
// Failures without a revision go to the end. |
- assert(analyzer._failureListComparator('chromium', group4, group1) < 0); |
+ assert(analyzer._failureByTreeListComparator('chromium', group4, group1) < 0); |
+ |
+ // Support for git hashes. |
+ var group1hash = new CTFailureGroup("0", [], ['chromium:123abc', 'blink:2'], null); |
+ var group2hash = new CTFailureGroup("1", [], ['chromium:abc123', 'blink:1'], null); |
+ assert(analyzer._failureByTreeListComparator('chromium', group1hash, group2hash) > 0); |
+ assert(analyzer._failureByTreeListComparator('chromium', group2hash, group1hash) < 0); |
+ assert(analyzer._failureByTreeListComparator('chromium', group1hash, group1hash) == 0); |
}); |
}); |
}); |