Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Tools / GardeningServer / model / ct-step-failure-group-data.html
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 <link rel="import" href="ct-builder-list.html">
8 <link rel="import" href="ct-commit-list.html">
9
10 <script>
11 function CTStepFailureGroupData(failures, commitList) {
12   this.failures = failures;
13   this.key = failures.map(function(failure) {
14     return failure.key;
15   }).join('::');
16   this.commitList = commitList;
17   this.builderList = new CTBuilderList(failures);
18   this.category = 'step';
19 };
20
21 CTStepFailureGroupData.prototype.getAnnotations = function() {
22   return this.failures.map(function(failure) {
23     return failure.annotations();
24   }).flatten();
25 };
26
27 CTStepFailureGroupData.prototype.failureKeys = function() {
28   return this.failures.map(function(failure) {
29     return failure.keys();
30   }).flatten();
31 };
32
33 CTStepFailureGroupData.prototype.isTreeCloser = function() {
34   return this.failures.any(function(failure) {
35     return failure.isTreeCloser();
36   });
37 };
38
39 CTStepFailureGroupData.prototype.failedOnce = function() {
40   if (!this.failures.length)
41     return false;
42
43   for (var i = 0; i < this.failures.length; i++) {
44     var totalFailures = 0;
45     var resultNodes = this.failures[i].resultNodesByBuilder;
46     for (var r in resultNodes) {
47       totalFailures += resultNodes[r].failingBuildCount;
48       if (totalFailures > 1)
49         return false;
50     }
51   }
52   return true;
53 };
54
55 CTStepFailureGroupData.prototype.fileBugMessage = function() {
56   var message = '';
57   this.failures.forEach(function(failure) {
58     message += failure.step;
59     if (failure.testName) {
60       message += ' ' + failure.testName + '\n';
61       message += failure.flakinessDashboardURL(this.tree);
62     }
63     message += '\n';
64   });
65   message += '\nRevision range:\n';
66   this.commitList.repositories.forEach(function(repository) {
67     message += repository.name + ' ' + repository.range + '\n';
68   });
69   message += '\nFailing builders:\n';
70   this.builderList.builders.forEach(function(builder) {
71     message += builder.builder + ': ' + builder.buildUrl + '\n';
72   });
73
74   return message;
75 };
76
77 CTStepFailureGroupData.prototype.fileBugLink = function() {
78   var fileBugUrl = 'https://code.google.com/p/chromium/issues/entry?' +
79       'status=Available&labels=Pri-2,gardening-blink&' +
80       'summary=Build%20failure&comment=Build%20is%20broken:%0a';
81   return fileBugUrl + encodeURIComponent(this.fileBugMessage());
82 };
83 </script>