| 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 | 6 |
| 7 <link rel="import" href="ct-commit-list.html"> | 7 <link rel="import" href="ct-commit-list.html"> |
| 8 | 8 |
| 9 <script> | 9 <script> |
| 10 function CTFailureGroup(key, data) { | 10 function CTFailureGroup(key, data, category) { |
| 11 this.key = key; | 11 this.key = key; |
| 12 this.data = data; | 12 this.data = data; |
| 13 this._annotation = CTFailureGroup._mergeAnnotations(data.getAnnotations()); | 13 this._annotation = CTFailureGroup._mergeAnnotations(data.getAnnotations()); |
| 14 this._originalCategory = category || 'default'; |
| 14 this._computeProperties(); | 15 this._computeProperties(); |
| 15 } | 16 } |
| 16 | 17 |
| 17 CTFailureGroup.prototype.dataToExamine = function() { | 18 CTFailureGroup.prototype.dataToExamine = function() { |
| 18 return this.data.dataToExamine(); | 19 return this.data.dataToExamine(); |
| 19 } | 20 } |
| 20 | 21 |
| 21 CTFailureGroup.prototype.snoozeUntil = function(time) { | 22 CTFailureGroup.prototype.snoozeUntil = function(time) { |
| 22 return this._annotate({ | 23 return this._annotate({ |
| 23 snoozeTime: time, | 24 snoozeTime: time, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 59 } |
| 59 | 60 |
| 60 CTFailureGroup.prototype._computeProperties = function() { | 61 CTFailureGroup.prototype._computeProperties = function() { |
| 61 this.isSnoozed = Date.now() < this._annotation.snoozeTime; | 62 this.isSnoozed = Date.now() < this._annotation.snoozeTime; |
| 62 if (this.isSnoozed) { | 63 if (this.isSnoozed) { |
| 63 this.category = 'snoozed'; | 64 this.category = 'snoozed'; |
| 64 } else { | 65 } else { |
| 65 if (this._failedOnce()) { | 66 if (this._failedOnce()) { |
| 66 this.category = 'failedOnce'; | 67 this.category = 'failedOnce'; |
| 67 } else { | 68 } else { |
| 68 this.category = 'default'; | 69 this.category = this._originalCategory; |
| 69 } | 70 } |
| 70 // FIXME: crbug.com/400397 Split into: Whole step failure, Tree closer, Test
failure, Flaky tests | 71 // FIXME: crbug.com/400397 Split into: Whole step failure, Tree closer, Test
failure, Flaky tests |
| 71 } | 72 } |
| 72 | 73 |
| 73 this.bug = this._annotation.bug; | 74 this.bug = this._annotation.bug; |
| 74 // FIXME: Bug labels would be simpler to implement as a filter in the UI. | 75 // FIXME: Bug labels would be simpler to implement as a filter in the UI. |
| 75 if (this.bug != null) | 76 if (this.bug != null) |
| 76 this.bugLabel = 'Bug ' + /([0-9]{3,})/.exec(this.bug)[0]; | 77 this.bugLabel = 'Bug ' + /([0-9]{3,})/.exec(this.bug)[0]; |
| 77 else | 78 else |
| 78 this.bugLabel = undefined; | 79 this.bugLabel = undefined; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 }.bind(this)); | 127 }.bind(this)); |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 CTFailureGroup.fetchAnnotations = function() { | 130 CTFailureGroup.fetchAnnotations = function() { |
| 130 // FIXME: Fetch annotations from frontend. | 131 // FIXME: Fetch annotations from frontend. |
| 131 var stored = localStorage.CTFailureGroupAnnotations; | 132 var stored = localStorage.CTFailureGroupAnnotations; |
| 132 var annotations = stored ? JSON.parse(stored) : {}; | 133 var annotations = stored ? JSON.parse(stored) : {}; |
| 133 return Promise.resolve(annotations); | 134 return Promise.resolve(annotations); |
| 134 }; | 135 }; |
| 135 </script> | 136 </script> |
| OLD | NEW |