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 + '::' + reason; 10 this.step = step; 11 // FIXME: Rename this to reason. 12 this.testName = reason; 13 // Maps a builder_name (e.g. "Mac ASan Tests (1)") 14 // to the details of the failure on that builder. 15 this.resultNodesByBuilder = resultsByBuilder; 16 } 17 18 CTStepFailure.prototype.flakinessDashboardURL = function() { 19 var testType = this.step; 20 21 // FIXME: Remove this once the flakiness dashboard stops having webkit_tests 22 // masquerade as layout-tests. 23 if (testType == 'webkit_tests') 24 testType = 'layout-tests'; 25 26 return 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#' + 27 Object.toQueryString({ 28 tests: this.testName, 29 testType: testType, 30 }); 31 } 32 33 CTStepFailure.prototype.embeddedFlakinessDashboardURL = function() { 34 return this.flakinessDashboardURL() + '&showChrome=false'; 35 } 36 37 CTStepFailure.prototype.reasonGroupName = function() { 38 if (!this.testName) 39 return undefined; 40 if (this.step == 'webkit_tests') 41 return this.testName.substr(0, this.testName.lastIndexOf('/')); 42 return this.testName.substr(0, this.testName.lastIndexOf('.')); 43 }; 44 45 CTStepFailure.prototype.keys = function() { 46 return Object.values(this.resultNodesByBuilder).map('key'); 47 }; 48 49 CTStepFailure.prototype.annotations = function() { 50 var annotations = []; 51 Object.values(this.resultNodesByBuilder, function(result) { 52 annotations.push(result.annotation ? result.annotation : {}); 53 }); 54 return annotations; 55 }; 56 57 // FIXME: This should just be provided as part of the alerts feed. 58 CTStepFailure.createKey = function(alert) { 59 function normalize(str) { 60 str = str == null ? '' : String(str); 61 return str.replace(/:/g, '_'); 62 } 63 return [alert.master_url, alert.builder_name, alert.failing_build, alert.step_name, alert.reason].map(normalize).join('::'); 64 } 65 </script> 66