OLD | NEW |
| (Empty) |
1 <!-- | |
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 | |
4 found in the LICENSE file. | |
5 --> | |
6 | |
7 <script> | |
8 function CTStepFailure(step, reason, resultsByBuilder) { | |
9 this.key = step + '::' | |
10 | |
11 // The key needs to be unique, so disambiguate null reason | |
12 // failures by their builders, but don't do regular failures | |
13 // by builders because we want failures with reasons to update | |
14 // the existing failure group instead of causing the group to | |
15 // get recreated since throwing it away loses in app state. | |
16 if (reason) | |
17 this.key += reason; | |
18 else | |
19 this.key += Object.keys(resultsByBuilder).join('::'); | |
20 | |
21 this.step = step; | |
22 // FIXME: Rename this to reason. | |
23 this.testName = reason; | |
24 // Maps a builder_name (e.g. "Mac ASan Tests (1)") | |
25 // to the details of the failure on that builder. | |
26 this.resultNodesByBuilder = resultsByBuilder; | |
27 } | |
28 | |
29 CTStepFailure.prototype.isTreeCloser = function() { | |
30 for (var builder in this.resultNodesByBuilder) { | |
31 var result = this.resultNodesByBuilder[builder]; | |
32 if (result.isTreeCloser) | |
33 return true; | |
34 } | |
35 return false; | |
36 }; | |
37 | |
38 CTStepFailure.prototype.flakinessDashboardURL = function() { | |
39 var testType = this.step; | |
40 | |
41 // FIXME: Remove this once the flakiness dashboard stops having webkit_tests | |
42 // masquerade as layout-tests. | |
43 if (testType == 'webkit_tests') | |
44 testType = 'layout-tests'; | |
45 | |
46 return 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#'
+ | |
47 Object.toQueryString({ | |
48 tests: this.testName, | |
49 testType: testType, | |
50 }); | |
51 } | |
52 | |
53 CTStepFailure.prototype.embeddedFlakinessDashboardURL = function() { | |
54 return this.flakinessDashboardURL() + '&showChrome=false'; | |
55 } | |
56 | |
57 CTStepFailure.prototype.reasonGroupName = function() { | |
58 if (!this.testName) | |
59 return undefined; | |
60 if (this.step == 'webkit_tests') | |
61 return this.testName.substr(0, this.testName.lastIndexOf('/')); | |
62 return this.testName.substr(0, this.testName.lastIndexOf('.')); | |
63 }; | |
64 | |
65 CTStepFailure.prototype.keys = function() { | |
66 return Object.values(this.resultNodesByBuilder).map('key'); | |
67 }; | |
68 | |
69 CTStepFailure.prototype.annotations = function() { | |
70 var annotations = []; | |
71 Object.values(this.resultNodesByBuilder, function(result) { | |
72 annotations.push(result.annotation ? result.annotation : {}); | |
73 }); | |
74 return annotations; | |
75 }; | |
76 | |
77 // FIXME: This should just be provided as part of the alerts feed. | |
78 CTStepFailure.createKey = function(alert) { | |
79 function normalize(str) { | |
80 str = str == null ? '' : String(str); | |
81 return str.replace(/:/g, '_'); | |
82 } | |
83 return [alert.master_url, alert.builder_name, alert.failing_build, alert.step_
name, alert.reason].map(normalize).join('::'); | |
84 } | |
85 </script> | |
OLD | NEW |