| 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 --><html><head><link rel="import" href="ct-results-comparison.html"> |
| 6 | 6 |
| 7 <link rel="import" href="ct-results-comparison.html"> | 7 <!-- |
| 8 | 8 TODO(polyup): unable to infer path to components |
| 9 <polymer-element name="ct-results-detail" attributes="failure builder"> | 9 directory. This import path is probably incomplete. |
| 10 <template> | 10 --> |
| 11 <style> | 11 <link rel="import" href="iron-flex-layout/iron-flex-layout.html"> |
| 12 <dom-module id="ct-results-detail"> |
| 13 <style> |
| 14 /* TODO(polyup): For speed, consider reworking these styles with .classes |
| 15 and #ids rather than [attributes]. |
| 16 */ |
| 17 [layout] { |
| 18 @apply(--layout); |
| 19 } |
| 20 [layout][vertical] { |
| 21 @apply(--layout-vertical); |
| 22 } |
| 23 [layout][flex] { |
| 24 @apply(--layout-flex); |
| 25 } |
| 26 </style> |
| 27 <style> |
| 12 :host { | 28 :host { |
| 13 display: block; | 29 display: block; |
| 14 } | 30 } |
| 15 </style> | 31 </style> |
| 16 <template if="{{!_urlGroups.length}}"> | 32 <template> |
| 33 <template is="dom-if" if="{{!_urlGroups.length}}"> |
| 17 No results to display. | 34 No results to display. |
| 18 </template> | 35 </template> |
| 19 <template repeat="{{urlGroup in _urlGroups}}"> | 36 <template is="dom-repeat" items="{{_urlGroups}}" as="urlGroup"> |
| 20 <template if="{{urlGroup.urls[_kUnknownKind]}}"> | 37 <template is="dom-if" if="{{computeUrl(_kUnknownKind, urlGroup)}}"> |
| 21 <ct-test-output type="{{urlGroup.type}}" url="{{urlGroup.urls[_kUnknownK
ind]}}" flex layout vertical></ct-test-output> | 38 <ct-test-output type="{{urlGroup.type}}" url="{{computeUrl(_kUnknownKind
, urlGroup)}}" flex="" layout="" vertical=""></ct-test-output> |
| 22 </template> | 39 </template> |
| 23 <template if="{{!urlGroup.urls[_kUnknownKind]}}"> | 40 <template is="dom-if" if="{{computeIf(_kUnknownKind, urlGroup)}}"> |
| 24 <ct-results-comparison type="{{urlGroup.type}}" expectedUrl="{{urlGroup.
urls[_kExpectedKind]}}" | 41 <ct-results-comparison type="{{urlGroup.type}}" expectedurl="{{computeEx
pectedurl(_kExpectedKind, urlGroup)}}" actualurl="{{computeActualurl(_kActualKin
d, urlGroup)}}" diffurl="{{computeDiffurl(_kDiffKind, urlGroup)}}" flex="" layou
t="" vertical=""></ct-results-comparison> |
| 25 actualUrl="{{urlGroup.urls[_kActualKind]}}" diffUrl="{{urlGroup.urls
[_kDiffKind]}}" flex layout vertical></ct-results-comparison> | |
| 26 </template> | 42 </template> |
| 27 </template> | 43 </template> |
| 28 </template> | 44 </template> |
| 29 <script> | 45 <script> |
| 30 Polymer({ | 46 Polymer({ |
| 31 failure: null, | 47 is: 'ct-results-detail', |
| 32 // FIXME: Initializing builder gives a JS error. Presumably because | 48 properties: { |
| 33 // ct-results-by-builder sets builder="{{builders[selected]}}". But, | 49 // FIXME: Initializing builder gives a JS error. Presumably because |
| 34 // it seems wrong that the way the parent uses this element constrains | 50 // ct-results-by-builder sets builder="{{builders[selected]}}". But, |
| 35 // what the element can do. Polymer bug? | 51 // it seems wrong that the way the parent uses this element constrains |
| 36 // builder: '', | 52 // what the element can do. Polymer bug? |
| 37 | 53 // builder: '', |
| 38 _urlGroups: [], | 54 _urlGroups: { |
| 55 type: Array, |
| 56 value: function () { |
| 57 return []; |
| 58 } |
| 59 }, |
| 60 builder: { |
| 61 notify: true, |
| 62 observer: '_update' |
| 63 }, |
| 64 failure: { |
| 65 value: null, |
| 66 notify: true, |
| 67 observer: '_update' |
| 68 } |
| 69 }, |
| 39 _kExpectedKind: results.kExpectedKind, | 70 _kExpectedKind: results.kExpectedKind, |
| 40 _kActualKind: results.kActualKind, | 71 _kActualKind: results.kActualKind, |
| 41 _kDiffKind: results.kDiffKind, | 72 _kDiffKind: results.kDiffKind, |
| 42 _kUnknownKind: results.kUnknownKind, | 73 _kUnknownKind: results.kUnknownKind, |
| 43 | 74 _isStdioStep: function (result, step) { |
| 44 observe: { | |
| 45 failure: '_update', | |
| 46 builder: '_update', | |
| 47 }, | |
| 48 | |
| 49 _isStdioStep: function(result, step) { | |
| 50 return result.actual == 'UNKNOWN' || step == 'compile'; | 75 return result.actual == 'UNKNOWN' || step == 'compile'; |
| 51 }, | 76 }, |
| 52 | 77 _update: function () { |
| 53 _update: function() { | |
| 54 if (!this.failure || !this.builder) | 78 if (!this.failure || !this.builder) |
| 55 return; | 79 return; |
| 56 | |
| 57 // FIXME: If the types of groups doesn't change, then it'd be better to
do this | 80 // FIXME: If the types of groups doesn't change, then it'd be better to
do this |
| 58 // update in place so that the user doesn't see a flicker. | 81 // update in place so that the user doesn't see a flicker. |
| 59 this._urlGroups = []; | 82 this._urlGroups = []; |
| 60 | |
| 61 var result = this.failure.resultNodesByBuilder[this.builder]; | 83 var result = this.failure.resultNodesByBuilder[this.builder]; |
| 62 // FIXME: There's probably a less hacky way to check this. | 84 // FIXME: There's probably a less hacky way to check this. |
| 63 if (result.actual == 'FAIL' || this._isStdioStep(result, this.failure.st
ep)) | 85 if (result.actual == 'FAIL' || this._isStdioStep(result, this.failure.st
ep)) |
| 64 this._updateUrls(); | 86 this._updateUrls(); |
| 65 else | 87 else |
| 66 this._updateWebkitTestUrls(); | 88 this._updateWebkitTestUrls(); |
| 67 }, | 89 }, |
| 68 | 90 _updateWebkitTestUrls: function () { |
| 69 _updateWebkitTestUrls: function() { | |
| 70 var result = this.failure.resultNodesByBuilder[this.builder]; | 91 var result = this.failure.resultNodesByBuilder[this.builder]; |
| 71 var failureInfo = results.failureInfo(this.failure.testName, this.builde
r, result.actual); | 92 var failureInfo = results.failureInfo(this.failure.testName, this.builde
r, result.actual); |
| 72 | |
| 73 // FIXME: Move this logic to a proper model class so that the network re
quests this makes | 93 // FIXME: Move this logic to a proper model class so that the network re
quests this makes |
| 74 // can be easily mocked out in tests. | 94 // can be easily mocked out in tests. |
| 75 results.fetchResultsURLs(failureInfo).then(function(resultsUrls) { | 95 results.fetchResultsURLs(failureInfo).then(function (resultsUrls) { |
| 76 var resultsUrlsByTypeAndKind = {}; | 96 var resultsUrlsByTypeAndKind = {}; |
| 77 resultsUrls.forEach(function(url) { | 97 resultsUrls.forEach(function (url) { |
| 78 var resultType = results.resultType(url); | 98 var resultType = results.resultType(url); |
| 79 if (!resultsUrlsByTypeAndKind[resultType]) | 99 if (!resultsUrlsByTypeAndKind[resultType]) |
| 80 resultsUrlsByTypeAndKind[resultType] = {}; | 100 resultsUrlsByTypeAndKind[resultType] = {}; |
| 81 resultsUrlsByTypeAndKind[resultType][results.resultKind(url)] = ur
l; | 101 resultsUrlsByTypeAndKind[resultType][results.resultKind(url)] = url; |
| 82 }); | 102 }); |
| 83 | 103 Object.keys(resultsUrlsByTypeAndKind, function (resultType, resultsUrl
sByKind) { |
| 84 Object.keys(resultsUrlsByTypeAndKind, function(resultType, resultsUrls
ByKind) { | |
| 85 this._urlGroups.push({ | 104 this._urlGroups.push({ |
| 86 type: resultType, | 105 type: resultType, |
| 87 urls: resultsUrlsByKind, | 106 urls: resultsUrlsByKind |
| 88 }); | 107 }); |
| 89 }.bind(this)); | 108 }.bind(this)); |
| 90 }.bind(this)); | 109 }.bind(this)); |
| 91 }, | 110 }, |
| 92 | 111 _updateUrls: function () { |
| 93 _updateUrls: function() { | |
| 94 // FIXME: Along with _updateWebkitTestUrls, move this logic to a proper
model class | 112 // FIXME: Along with _updateWebkitTestUrls, move this logic to a proper
model class |
| 95 // so that the network requests this makes can be easily mocked out in t
ests. | 113 // so that the network requests this makes can be easily mocked out in t
ests. |
| 96 | |
| 97 var result = this.failure.resultNodesByBuilder[this.builder]; | 114 var result = this.failure.resultNodesByBuilder[this.builder]; |
| 98 | |
| 99 // FIXME: We only store build logs by the test name, not the testsuite.t
estname, | 115 // FIXME: We only store build logs by the test name, not the testsuite.t
estname, |
| 100 // which means that two failing tests from different test suites conflic
t! | 116 // which means that two failing tests from different test suites conflic
t! |
| 101 var testPart = this._isStdioStep(result, this.failure.step) ? 'stdio' :
this.failure.testName; | 117 var testPart = this._isStdioStep(result, this.failure.step) ? 'stdio' :
this.failure.testName; |
| 102 // Fix url for parameterized gtests, e.g.: /2 -> _2. | 118 // Fix url for parameterized gtests, e.g.: /2 -> _2. |
| 103 testPart = testPart.replace(/\/(\d+)$/, "_$1"); | 119 testPart = testPart.replace(/\/(\d+)$/, '_$1'); |
| 104 var url = result.masterUrl + | 120 var url = result.masterUrl + '/builders/' + encodeURIComponent(this.buil
der); |
| 105 '/builders/' + encodeURIComponent(this.builder); | |
| 106 | |
| 107 // FIXME: Make failure groups aware of their own url | 121 // FIXME: Make failure groups aware of their own url |
| 108 if (this.failure.testName) | 122 if (this.failure.testName) |
| 109 url += | 123 url += '/builds/' + result.lastFailingBuild + '/steps/' + this.failure
.step + '/logs/' + testPart; |
| 110 '/builds/' + result.lastFailingBuild + | |
| 111 '/steps/' + this.failure.step + | |
| 112 '/logs/' + testPart; | |
| 113 | |
| 114 var resultsUrlsByKind = {}; | 124 var resultsUrlsByKind = {}; |
| 115 resultsUrlsByKind[this._kUnknownKind] = url; | 125 resultsUrlsByKind[this._kUnknownKind] = url; |
| 116 | |
| 117 this._urlGroups.push({ | 126 this._urlGroups.push({ |
| 118 type: results.kTextType, | 127 type: results.kTextType, |
| 119 urls: resultsUrlsByKind, | 128 urls: resultsUrlsByKind |
| 120 }); | 129 }); |
| 121 }, | 130 }, |
| 131 computeUrl: function (_kUnknownKind, urlGroup) { |
| 132 return urlGroup.urls[_kUnknownKind]; |
| 133 }, |
| 134 computeIf: function (_kUnknownKind, urlGroup) { |
| 135 return !urlGroup.urls[_kUnknownKind]; |
| 136 }, |
| 137 computeExpectedurl: function (_kExpectedKind, urlGroup) { |
| 138 return urlGroup.urls[_kExpectedKind]; |
| 139 }, |
| 140 computeActualurl: function (_kActualKind, urlGroup) { |
| 141 return urlGroup.urls[_kActualKind]; |
| 142 }, |
| 143 computeDiffurl: function (_kDiffKind, urlGroup) { |
| 144 return urlGroup.urls[_kDiffKind]; |
| 145 } |
| 122 }); | 146 }); |
| 123 </script> | 147 </script> |
| 124 </polymer-element> | 148 </dom-module> |
| OLD | NEW |