Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: Tools/GardeningServer/scripts/ui/results.js

Issue 173133003: Convert garden-o-matic guts over to promises where appropriate (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update to ToT Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 $.each(resultsURLsByTypeAndKind, function(resultType, resultsURLsByKind) { 142 $.each(resultsURLsByTypeAndKind, function(resultType, resultsURLsByKind) {
143 if ($.isEmptyObject(resultsURLsByKind)) 143 if ($.isEmptyObject(resultsURLsByKind))
144 return; 144 return;
145 if (results.kUnknownKind in resultsURLsByKind) { 145 if (results.kUnknownKind in resultsURLsByKind) {
146 // This is something like "crash" that isn't a comparison. 146 // This is something like "crash" that isn't a comparison.
147 this.addRow(resultType, resultsURLsByKind[results.kUnknownKind]) ; 147 this.addRow(resultType, resultsURLsByKind[results.kUnknownKind]) ;
148 return; 148 return;
149 } 149 }
150 this.addComparison(resultType, resultsURLsByKind); 150 this.addComparison(resultType, resultsURLsByKind);
151 }.bind(this)); 151 }.bind(this));
152
153 if (!this.children.length) 152 if (!this.children.length)
154 this.textContent = 'No results to display.' 153 this.textContent = 'No results to display.'
155 } 154 }
156 }); 155 });
157 156
158 ui.results.ResultsDetails = base.extends('div', { 157 ui.results.ResultsDetails = base.extends('div', {
159 init: function(delegate, failureInfo) 158 init: function(delegate, failureInfo)
160 { 159 {
161 this.className = 'results-detail'; 160 this.className = 'results-detail';
162 this._delegate = delegate; 161 this._delegate = delegate;
163 this._failureInfo = failureInfo; 162 this._failureInfo = failureInfo;
164 this._haveShownOnce = false; 163 this._haveShownOnce = false;
165 }, 164 },
166 show: function() { 165 show: function() {
167 if (this._haveShownOnce) 166 if (this._haveShownOnce)
168 return; 167 return;
169 this._haveShownOnce = true; 168 this._haveShownOnce = true;
170 this._delegate.fetchResultsURLs(this._failureInfo, function(resultsURLs) { 169 this._delegate.fetchResultsURLs(this._failureInfo).then(function(results URLs) {
171 var resultsGrid = new ui.results.ResultsGrid(); 170 var resultsGrid = new ui.results.ResultsGrid();
172 resultsGrid.addResults(resultsURLs); 171 resultsGrid.addResults(resultsURLs);
173 172
174 $(this).empty().append( 173 $(this).empty().append(
175 new ui.actions.List([ 174 new ui.actions.List([
176 new ui.actions.Previous(), 175 new ui.actions.Previous(),
177 new ui.actions.Next() 176 new ui.actions.Next()
178 ])).append(resultsGrid); 177 ])).append(resultsGrid);
179 178
180 179
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 var failureInfo = results.failureInfoForTestAndBuilder(this._resultsByTe st, testName, builderName); 424 var failureInfo = results.failureInfoForTestAndBuilder(this._resultsByTe st, testName, builderName);
426 return new ui.results.ResultsDetails(this, failureInfo); 425 return new ui.results.ResultsDetails(this, failureInfo);
427 }, 426 },
428 setResultsByTest: function(resultsByTest) 427 setResultsByTest: function(resultsByTest)
429 { 428 {
430 $(this).empty(); 429 $(this).empty();
431 this._resultsByTest = resultsByTest; 430 this._resultsByTest = resultsByTest;
432 this._testSelector = new ui.results.TestSelector(this, resultsByTest); 431 this._testSelector = new ui.results.TestSelector(this, resultsByTest);
433 this.appendChild(this._testSelector); 432 this.appendChild(this._testSelector);
434 }, 433 },
435 fetchResultsURLs: function(failureInfo, callback) 434 fetchResultsURLs: function(failureInfo)
436 { 435 {
437 this._delegate.fetchResultsURLs(failureInfo, callback) 436 return this._delegate.fetchResultsURLs(failureInfo);
438 }, 437 },
439 nextResult: function() 438 nextResult: function()
440 { 439 {
441 return this._testSelector.nextResult(); 440 return this._testSelector.nextResult();
442 }, 441 },
443 previousResult: function() 442 previousResult: function()
444 { 443 {
445 return this._testSelector.previousResult(); 444 return this._testSelector.previousResult();
446 }, 445 },
447 nextTest: function() 446 nextTest: function()
448 { 447 {
449 return this._testSelector.nextTest(); 448 return this._testSelector.nextTest();
450 }, 449 },
451 previousTest: function() 450 previousTest: function()
452 { 451 {
453 return this._testSelector.previousTest(); 452 return this._testSelector.previousTest();
454 }, 453 },
455 firstResult: function() 454 firstResult: function()
456 { 455 {
457 this._testSelector.firstResult() 456 this._testSelector.firstResult()
458 }, 457 },
459 currentTestName: function() 458 currentTestName: function()
460 { 459 {
461 return this._testSelector.currentTestName() 460 return this._testSelector.currentTestName()
462 } 461 }
463 }); 462 });
464 463
465 })(); 464 })();
OLDNEW
« no previous file with comments | « Tools/GardeningServer/scripts/ui.js ('k') | Tools/GardeningServer/scripts/ui/results_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698