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.
7 <link rel="import" href="ct-results-comparison.html">
9 <polymer-element name="ct-results-detail" attributes="failure builder">
16 <template if="{{!_urlGroups.length}}">
17 No results to display.
19 <template repeat="{{urlGroup in _urlGroups}}">
20 <template if="{{urlGroup.urls[_kUnknownKind]}}">
21 <ct-test-output type="{{urlGroup.type}}" url="{{urlGroup.urls[_kUnknownKind]}}"></ct-test-output>
23 <template if="{{!urlGroup.urls[_kUnknownKind]}}">
24 <ct-results-comparison type="{{urlGroup.type}}" expectedUrl="{{urlGroup.urls[_kExpectedKind]}}"
25 actualUrl="{{urlGroup.urls[_kActualKind]}}" diffUrl="{{urlGroup.urls[_kDiffKind]}}"></ct-results-comparison>
32 // FIXME: Initializing builder gives a JS error. Presumably because
33 // ct-results-by-builder sets builder="{{builders[selected]}}". But,
34 // it seems wrong that the way the parent uses this element constrains
35 // what the element can do. Polymer bug?
39 _kExpectedKind: results.kExpectedKind,
40 _kActualKind: results.kActualKind,
41 _kDiffKind: results.kDiffKind,
42 _kUnknownKind: results.kUnknownKind,
50 if (!this.failure || !this.builder)
53 // FIXME: If the types of groups doesn't change, then it'd be better to do this
54 // update in place so that the user doesn't see a flicker.
57 var result = this.failure.resultNodesByBuilder[this.builder];
58 // FIXME: There's probably a less hacky way to check this.
59 if (result.actual == 'FAIL' || result.actual == 'UNKNOWN')
62 this._updateWebkitTestUrls();
65 _updateWebkitTestUrls: function() {
66 var result = this.failure.resultNodesByBuilder[this.builder];
67 var failureInfo = results.failureInfo(this.failure.testName, this.builder, result.actual);
69 // FIXME: Move this logic to a proper model class so that the network requests this makes
70 // can be easily mocked out in tests.
71 results.fetchResultsURLs(failureInfo).then(function(resultsUrls) {
72 var resultsUrlsByTypeAndKind = {};
73 resultsUrls.forEach(function(url) {
74 var resultType = results.resultType(url);
75 if (!resultsUrlsByTypeAndKind[resultType])
76 resultsUrlsByTypeAndKind[resultType] = {};
77 resultsUrlsByTypeAndKind[resultType][results.resultKind(url)] = url;
80 Object.keys(resultsUrlsByTypeAndKind, function(resultType, resultsUrlsByKind) {
81 this._urlGroups.push({
83 urls: resultsUrlsByKind,
89 _updateUrls: function() {
90 // FIXME: Along with _updateWebkitTestUrls, move this logic to a proper model class
91 // so that the network requests this makes can be easily mocked out in tests.
93 var result = this.failure.resultNodesByBuilder[this.builder];
95 // FIXME: We only store build logs by the test name, not the testsuite.testname,
96 // which means that two failing tests from different test suites conflict!
97 var testPart = result.actual == 'UNKNOWN' ? 'stdio' : this.failure.testName.split('.')[1];
98 var url = result.masterUrl +
99 '/builders/' + encodeURIComponent(this.builder) +
100 '/builds/' + result.lastFailingBuild +
101 '/steps/' + this.failure.step +
104 var resultsUrlsByKind = {};
105 resultsUrlsByKind[this._kUnknownKind] = url;
107 this._urlGroups.push({
108 type: results.kTextType,
109 urls: resultsUrlsByKind,