Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js (94630 => 94631)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js 2011-09-07 03:00:55 UTC (rev 94630)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js 2011-09-07 03:41:52 UTC (rev 94631)
@@ -33,8 +33,18 @@
this._view = view;
this._resultsByTest = resultsByTest;
this._view.setResultsByTest(resultsByTest);
- // FIXME: Wire up some actions.
+
+ $(this._view).bind('next', this.onNext.bind(this));
+ $(this._view).bind('previous', this.onPrevious.bind(this));
},
+ onNext: function()
+ {
+ this._view.nextResult();
+ },
+ onPrevious: function()
+ {
+ this._view.previousResult();
+ }
});
var FailureStreamController = base.extends(Object, {
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js (94630 => 94631)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js 2011-09-07 03:00:55 UTC (rev 94630)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js 2011-09-07 03:41:52 UTC (rev 94631)
@@ -153,7 +153,12 @@
this._delegate.fetchResultsURLs(this._failureInfo, function(resultsURLs) {
var resultsGrid = new ui.results.ResultsGrid();
resultsGrid.addResults(resultsURLs);
- $(this).empty().append(resultsGrid);
+ $(this).empty().append(
+ new ui.actions.List([
+ new ui.actions.Rebaseline().makeDefault(),
+ new ui.actions.Previous(),
+ new ui.actions.Next()
+ ])).append(resultsGrid);
}.bind(this));
},
});
@@ -163,19 +168,62 @@
{
this.className = 'test-selector';
this._delegate = delegate;
+ this._length = 0;
Object.keys(resultsByTest).forEach(function (testName) {
var link = document.createElement('a');
$(link).attr('href', '#').text(testName);
this.appendChild(document.createElement('h3')).appendChild(link);
this.appendChild(this._delegate.contentForTest(testName));
+ ++this._length; // There doesn't seem to be any good way to get this information from accordion.
}, this);
$(this).accordion({
collapsible: true,
autoHeight: false,
});
- $(this).accordion("activate", false);
+ $(this).accordion('activate', false);
+ },
+ nextResult: function()
+ {
+ var activeIndex = $(this).accordion('option', 'active');
+ if ($('.builder-selector', this)[activeIndex].nextResult())
+ return true;
+ return this.nextTest();
+ },
+ previousResult: function()
+ {
+ var activeIndex = $(this).accordion('option', 'active');
+ if ($('.builder-selector', this)[activeIndex].previousResult())
+ return true;
+ return this.previousTest();
+ },
+ nextTest: function()
+ {
+ var nextIndex = $(this).accordion('option', 'active') + 1;
+ if (nextIndex >= this._length) {
+ $(this).accordion('option', 'active', false);
+ return false;
+ }
+ $(this).accordion('option', 'active', nextIndex);
+ $('.builder-selector', this)[nextIndex].firstResult();
+ return true;
+ },
+ previousTest: function()
+ {
+ var previousIndex = $(this).accordion('option', 'active') - 1;
+ if (previousIndex < 0) {
+ $(this).accordion('option', 'active', false);
+ return false;
+ }
+ $(this).accordion('option', 'active', previousIndex);
+ $('.builder-selector', this)[previousIndex].lastResult();
+ return true;
+ },
+ firstResult: function()
+ {
+ $(this).accordion('option', 'active', 0);
+ $('.builder-selector', this)[0].firstResult();
}
});
@@ -200,6 +248,30 @@
}, this);
$(this).tabs();
+ },
+ nextResult: function()
+ {
+ var nextIndex = $(this).tabs('option', 'selected') + 1;
+ if (nextIndex >= $(this).tabs('length'))
+ return false
+ $(this).tabs('option', 'selected', nextIndex);
+ return true;
+ },
+ previousResult: function()
+ {
+ var previousIndex = $(this).tabs('option', 'selected') - 1;
+ if (previousIndex < 0)
+ return false;
+ $(this).tabs('option', 'selected', previousIndex);
+ return true;
+ },
+ firstResult: function()
+ {
+ $(this).tabs('option', 'selected', 0);
+ },
+ lastResult: function()
+ {
+ $(this).tabs('option', 'selected', $(this).tabs('length') - 1);
}
});
@@ -227,9 +299,8 @@
{
$(this).empty();
this._resultsByTest = resultsByTest;
-
- var testSelector = new ui.results.TestSelector(this, resultsByTest);
- $(testSelector).bind("accordionchangestart", function(event, ui) {
+ this._testSelector = new ui.results.TestSelector(this, resultsByTest);
+ $(this._testSelector).bind("accordionchangestart", function(event, ui) {
// Prefetch the first results from the network.
var resultsDetails = $('.results-detail', ui.newContent);
if (resultsDetails.length)
@@ -241,11 +312,23 @@
});
}, kResultsPrefetchDelayMS);
});
- this.appendChild(testSelector);
+ this.appendChild(this._testSelector);
},
fetchResultsURLs: function(failureInfo, callback)
{
this._delegate.fetchResultsURLs(failureInfo, callback)
+ },
+ nextResult: function()
+ {
+ return this._testSelector.nextResult();
+ },
+ previousResult: function()
+ {
+ return this._testSelector.previousResult();
+ },
+ firstResult: function()
+ {
+ this._testSelector.firstResult()
}
});
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results_unittests.js (94630 => 94631)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results_unittests.js 2011-09-07 03:00:55 UTC (rev 94630)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results_unittests.js 2011-09-07 03:41:52 UTC (rev 94631)
@@ -46,6 +46,24 @@
}
}
-// FIXME: Add some unit tests.
+test('View', 6, function() {
+ var delegate = {
+ fetchResultsURLs: function(failureInfo, callback) { return;}
+ };
+ var view = new ui.results.View(delegate);
+ view.setResultsByTest(kExampleResultsByTest);
+ view.firstResult();
+
+ view.nextResult();
+ equals($('.test-selector', view).accordion('option', 'active'), 0);
+ equals($($('.builder-selector', view)[0]).tabs('option', 'selected'), 1);
+ view.nextResult();
+ equals($('.test-selector', view).accordion('option', 'active'), 1);
+ equals($($('.builder-selector', view)[1]).tabs('option', 'selected'), 0);
+ view.previousResult();
+ equals($('.test-selector', view).accordion('option', 'active'), 0);
+ equals($($('.builder-selector', view)[0]).tabs('option', 'selected'), 1);
+});
+
})();