Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: Tools/GardeningServer/ui/test/ct-failure-analyzer-tests.html

Issue 498523002: [Sheriff-o-matic] Use likely_revisions instead of first_failing/last_passing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase + no sort Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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-failure-analyzer.html"> 7 <link rel="import" href="../ct-failure-analyzer.html">
8 8
9 <script> 9 <script>
10 (function () { 10 (function () {
(...skipping 12 matching lines...) Expand all
23 23
24 var failures = [failure4, failure3, failure2, failure1]; 24 var failures = [failure4, failure3, failure2, failure1];
25 var expectedFailures = [failure1, failure2, failure3, failure4]; 25 var expectedFailures = [failure1, failure2, failure3, failure4];
26 assert.deepEqual(failures.sort(analyzer._failureComparator), expectedFailu res); 26 assert.deepEqual(failures.sort(analyzer._failureComparator), expectedFailu res);
27 }); 27 });
28 }); 28 });
29 29
30 describe('_failureListComparator', function() { 30 describe('_failureListComparator', function() {
31 it('should compare failures correctly', function() { 31 it('should compare failures correctly', function() {
32 var analyzer = document.createElement('ct-failure-analyzer'); 32 var analyzer = document.createElement('ct-failure-analyzer');
33 var revision1 = { 33
34 'chromium': 1, 34 var cl1 = new CTCommitList(undefined, ['chromium:1', 'blink:2']);
35 'blink': 2 35 var cl2 = new CTCommitList(undefined, ['chromium:2', 'blink:1']);
36 }; 36 var cl3 = new CTCommitList(undefined, ['chromium:2', 'blink:2']);
37 var revision2 = { 37 var cl4 = new CTCommitList(undefined, []);
38 'chromium': 2, 38 var group1 = new CTFailureGroup([], cl1);
39 'blink': 1 39 var group2 = new CTFailureGroup([], cl2);
40 }; 40 var group3 = new CTFailureGroup([], cl3);
41 var revision3 = { 41 var group4 = new CTFailureGroup([], cl4);
42 'chromium': 2,
43 'blink': 2
44 };
45 var resultsByBuilder = {};
46 var failure1 = new CTFailure("step", "reason", resultsByBuilder, revision1 , revision1);
47 var failure2 = new CTFailure("step", "reason", resultsByBuilder, revision2 , revision2);
48 var failure3 = new CTFailure("step", "reason", resultsByBuilder, revision3 , revision3);
49 var failure4 = new CTFailure("step", "reason", resultsByBuilder, null, nul l);
50 var group1 = new CTFailureGroup([failure1], null);
51 var group2 = new CTFailureGroup([failure2], null);
52 var group3 = new CTFailureGroup([failure3], null);
53 var group4 = new CTFailureGroup([failure4], null);
54 42
55 // Sort by last revision first. 43 // Sort by last revision first.
56 assert(analyzer._failureListComparator('chromium', group1, group2) > 0); 44 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) > 0);
57 assert(analyzer._failureListComparator('chromium', group2, group1) < 0); 45 assert(analyzer._failureByTreeListComparator('chromium', group2, group1) < 0);
58 assert(analyzer._failureListComparator('chromium', group1, group1) == 0); 46 assert(analyzer._failureByTreeListComparator('chromium', group1, group1) = = 0);
59 47
60 // If the tree revisions are equal, take others. 48 // If the tree revisions are equal, take others.
61 assert(analyzer._failureListComparator('chromium', group2, group3) > 0); 49 assert(analyzer._failureByTreeListComparator('chromium', group2, group3) > 0);
62 50
63 // Prioritize the given tree. 51 // Prioritize the given tree.
64 assert(analyzer._failureListComparator('chromium', group1, group2) > 0); 52 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) > 0);
65 assert(analyzer._failureListComparator('blink', group1, group2) < 0); 53 assert(analyzer._failureByTreeListComparator('blink', group1, group2) < 0) ;
66 54
67 // Default to 'chromium'. 55 // Default to 'chromium'.
68 assert(analyzer._failureListComparator(undefined, group1, group2) > 0); 56 assert(analyzer._failureByTreeListComparator(undefined, group1, group2) > 0);
69 57
70 // Failures without a revision go to the end. 58 // Failures without a revision go to the end.
71 assert(analyzer._failureListComparator('chromium', group4, group1) < 0); 59 assert(analyzer._failureByTreeListComparator('chromium', group4, group1) > 0);
72 }); 60 });
73 }); 61 });
74 }); 62 });
75 63
76 })() 64 })()
77 </script> 65 </script>
OLDNEW
« no previous file with comments | « Tools/GardeningServer/ui/test/ct-commit-list-tests.html ('k') | Tools/GardeningServer/ui/test/ct-failure-card-tests.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698