| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 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 | 6 |
| 7 <link rel="import" href="../ct-failures.html"> | 7 <link rel="import" href="../ct-failures.html"> |
| 8 | 8 |
| 9 <script> | 9 <script> |
| 10 (function () { | 10 (function () { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 }); | 29 }); |
| 30 | 30 |
| 31 describe('failureByTreeListComparator', function() { | 31 describe('failureByTreeListComparator', function() { |
| 32 it('should compare failures correctly', function() { | 32 it('should compare failures correctly', function() { |
| 33 var analyzer = new CTFailures(new CTCommitList(undefined, [])); | 33 var analyzer = new CTFailures(new CTCommitList(undefined, [])); |
| 34 | 34 |
| 35 var cl1 = new CTCommitList(undefined, ['chromium:1', 'blink:2']); | 35 var cl1 = new CTCommitList(undefined, ['chromium:1', 'blink:2']); |
| 36 var cl2 = new CTCommitList(undefined, ['chromium:2', 'blink:1']); | 36 var cl2 = new CTCommitList(undefined, ['chromium:2', 'blink:1']); |
| 37 var cl3 = new CTCommitList(undefined, ['chromium:2', 'blink:2']); | 37 var cl3 = new CTCommitList(undefined, ['chromium:2', 'blink:2']); |
| 38 var cl4 = new CTCommitList(undefined, []); | 38 var cl4 = new CTCommitList(undefined, []); |
| 39 var group1 = new CTFailureGroup([], cl1); | 39 var group1 = new CTFailureGroup('', [], cl1); |
| 40 var group2 = new CTFailureGroup([], cl2); | 40 var group2 = new CTFailureGroup('', [], cl2); |
| 41 var group3 = new CTFailureGroup([], cl3); | 41 var group3 = new CTFailureGroup('', [], cl3); |
| 42 var group4 = new CTFailureGroup([], cl4); | 42 var group4 = new CTFailureGroup('', [], cl4); |
| 43 | 43 |
| 44 // Sort by last revision first. | 44 // Sort by last revision first. |
| 45 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) >
0); | 45 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) >
0); |
| 46 assert(analyzer._failureByTreeListComparator('chromium', group2, group1) <
0); | 46 assert(analyzer._failureByTreeListComparator('chromium', group2, group1) <
0); |
| 47 assert(analyzer._failureByTreeListComparator('chromium', group1, group1) =
= 0); | 47 assert(analyzer._failureByTreeListComparator('chromium', group1, group1) =
= 0); |
| 48 | 48 |
| 49 // If the tree revisions are equal, take others. | 49 // If the tree revisions are equal, take others. |
| 50 assert(analyzer._failureByTreeListComparator('chromium', group2, group3) >
0); | 50 assert(analyzer._failureByTreeListComparator('chromium', group2, group3) >
0); |
| 51 | 51 |
| 52 // Prioritize the given tree. | 52 // Prioritize the given tree. |
| 53 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) >
0); | 53 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) >
0); |
| 54 assert(analyzer._failureByTreeListComparator('blink', group1, group2) < 0)
; | 54 assert(analyzer._failureByTreeListComparator('blink', group1, group2) < 0)
; |
| 55 | 55 |
| 56 // Default to 'chromium'. | 56 // Default to 'chromium'. |
| 57 assert(analyzer._failureByTreeListComparator(undefined, group1, group2) >
0); | 57 assert(analyzer._failureByTreeListComparator(undefined, group1, group2) >
0); |
| 58 | 58 |
| 59 // Failures without a revision go to the end. | 59 // Failures without a revision go to the end. |
| 60 assert(analyzer._failureByTreeListComparator('chromium', group4, group1) >
0); | 60 assert(analyzer._failureByTreeListComparator('chromium', group4, group1) >
0); |
| 61 }); | 61 }); |
| 62 }); | 62 }); |
| 63 }); | 63 }); |
| 64 | 64 |
| 65 })() | 65 })() |
| 66 </script> | 66 </script> |
| OLD | NEW |