| 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 <link href="../model/ct-builder-revisions.html" rel="import"> | 6 <link href="../model/ct-builder-revisions.html" rel="import"> |
| 7 | 7 |
| 8 <link rel="import" href="../model/ct-failure.html"> | 8 <link rel="import" href="../model/ct-failure.html"> |
| 9 <link rel="import" href="../model/ct-failure-group.html"> |
| 9 | 10 |
| 10 <polymer-element name="ct-failure-analyzer" attributes="failures builderLatestRe
visions"> | 11 <polymer-element name="ct-failure-analyzer" attributes="failures builderLatestRe
visions"> |
| 11 <script> | 12 <script> |
| 12 // FIXME: Don't use a polymer component for this. Instead use a Failures mod
el | 13 // FIXME: Don't use a polymer component for this. Instead use a Failures mod
el |
| 13 // object that knows how to do the XHR and process the data appropriately. | 14 // object that knows how to do the XHR and process the data appropriately. |
| 14 Polymer({ | 15 Polymer({ |
| 15 builderLatestRevisions: null, | 16 builderLatestRevisions: null, |
| 16 failures: null, | 17 failures: null, |
| 17 | 18 |
| 18 // FIXME: Get this from https://chromium.googlesource.com/chromium/tools/b
uild/+/master/scripts/slave/gatekeeper_trees.json?format=text. | 19 // FIXME: Get this from https://chromium.googlesource.com/chromium/tools/b
uild/+/master/scripts/slave/gatekeeper_trees.json?format=text. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // Compare other revisions in alphabetical order. | 57 // Compare other revisions in alphabetical order. |
| 57 var keys = Object.keys(rev_a).sort(); | 58 var keys = Object.keys(rev_a).sort(); |
| 58 for (var i = 0; i < keys.length; i++) { | 59 for (var i = 0; i < keys.length; i++) { |
| 59 if (rev_a[keys[i]] != rev_b[keys[i]]) | 60 if (rev_a[keys[i]] != rev_b[keys[i]]) |
| 60 return rev_b[keys[i]] - rev_a[keys[i]]; | 61 return rev_b[keys[i]] - rev_a[keys[i]]; |
| 61 } | 62 } |
| 62 return 0; | 63 return 0; |
| 63 }, | 64 }, |
| 64 | 65 |
| 65 update: function() { | 66 update: function() { |
| 67 var annotationPromise = CTFailureGroup.fetchAnnotations(); |
| 66 net.json('http://auto-sheriff.appspot.com/data').then(function(data) { | 68 net.json('http://auto-sheriff.appspot.com/data').then(function(data) { |
| 67 // FIXME: Don't special-case the blink master. | 69 annotationPromise.then(function(annotations) { |
| 68 this.builderLatestRevisions = new CTBuilderRevisions(data.latest_revis
ions['chromium.webkit']); | 70 // FIXME: Don't special-case the blink master. |
| 69 this.failures = {}; | 71 this.builderLatestRevisions = new CTBuilderRevisions(data.latest_rev
isions['chromium.webkit']); |
| 70 data.range_groups.forEach(function(group) { | 72 this.failures = {}; |
| 71 this._processFailuresForGroup(group, data.alerts); | 73 data.range_groups.forEach(function(group) { |
| 72 }.bind(this)); | 74 this._processFailuresForGroup(group, data.alerts, annotations); |
| 73 Object.keys(this.failures, function (tree, failuresByTree) { | 75 }.bind(this)); |
| 74 this.failures[tree].sort(this._failureListComparator.bind(this, tree
)); | 76 Object.keys(this.failures, function (tree, failuresByTree) { |
| 77 this.failures[tree].sort(this._failureListComparator.bind(this, tr
ee)); |
| 78 }.bind(this)); |
| 75 }.bind(this)); | 79 }.bind(this)); |
| 76 }.bind(this)); | 80 }.bind(this)); |
| 77 }, | 81 }, |
| 78 | 82 |
| 79 _failureComparator: function(a, b) { | 83 _failureComparator: function(a, b) { |
| 80 if (a.step > b.step) | 84 if (a.step > b.step) |
| 81 return 1; | 85 return 1; |
| 82 if (a.step < b.step) | 86 if (a.step < b.step) |
| 83 return -1 | 87 return -1 |
| 84 if (a.testName > b.testName) | 88 if (a.testName > b.testName) |
| 85 return 1; | 89 return 1; |
| 86 if (a.testName < b.testName) | 90 if (a.testName < b.testName) |
| 87 return -1 | 91 return -1 |
| 88 return 0; | 92 return 0; |
| 89 }, | 93 }, |
| 90 | 94 |
| 91 _processFailuresForGroup: function(group, failures) { | 95 _processFailuresForGroup: function(group, failures, annotations) { |
| 92 var failuresByReason = {}; | 96 var failuresByReason = {}; |
| 93 | 97 |
| 94 var masterToTree = {}; | 98 var masterToTree = {}; |
| 95 Object.keys(this._trees, function(tree, masters) { | 99 Object.keys(this._trees, function(tree, masters) { |
| 96 masters.forEach(function(master) { | 100 masters.forEach(function(master) { |
| 97 masterToTree[master] = tree; | 101 masterToTree[master] = tree; |
| 98 }); | 102 }); |
| 99 }); | 103 }); |
| 100 | 104 |
| 101 group.failure_keys.forEach(function(failure_key) { | 105 group.failure_keys.forEach(function(failure_key) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 groupedFailures[tree] = []; | 147 groupedFailures[tree] = []; |
| 144 groupedFailures[tree].push(new CTFailure(failure.step, failure.reaso
n, resultsByBuilder, group.merged_first_failing, group.merged_last_passing)); | 148 groupedFailures[tree].push(new CTFailure(failure.step, failure.reaso
n, resultsByBuilder, group.merged_first_failing, group.merged_last_passing)); |
| 145 }) | 149 }) |
| 146 }); | 150 }); |
| 147 | 151 |
| 148 Object.keys(groupedFailures, function(tree, failures) { | 152 Object.keys(groupedFailures, function(tree, failures) { |
| 149 failures.sort(this._failureComparator); | 153 failures.sort(this._failureComparator); |
| 150 | 154 |
| 151 if (!this.failures[tree]) | 155 if (!this.failures[tree]) |
| 152 this.failures[tree] = []; | 156 this.failures[tree] = []; |
| 153 this.failures[tree].push(failures); | 157 // FIXME: Need a better identifier for a failure group; |
| 158 var key = group.sort_key; |
| 159 this.failures[tree].push(new CTFailureGroup(key, failures, annotations
[key])); |
| 154 }.bind(this)); | 160 }.bind(this)); |
| 155 }, | 161 }, |
| 156 }); | 162 }); |
| 157 </script> | 163 </script> |
| 158 </polymer-element> | 164 </polymer-element> |
| OLD | NEW |