Diff
Modified: trunk/Tools/ChangeLog (147456 => 147457)
--- trunk/Tools/ChangeLog 2013-04-02 17:58:16 UTC (rev 147456)
+++ trunk/Tools/ChangeLog 2013-04-02 17:59:14 UTC (rev 147457)
@@ -1,3 +1,45 @@
+2013-04-02 Julie Parent <[email protected]>
+
+ Dashboard refactor: Move dashboard specific history related features to History.
+ https://bugs.webkit.org/show_bug.cgi?id=113717
+
+ Reviewed by Ojan Vafai.
+
+ Each dashboard now creates its own History object, with a custom
+ configuration. This changes from just overriding global functions
+ to passing in callbacks for generatePage, handleValidHashParameter,
+ and handleQueryParameterChange. Same with passing in defaultStateValues
+ and DB_SPECIFIC_INVALIDATING_PARAMS, rather than overriding the global
+ variables.
+
+ All functions related to these features are now (mostly) private
+ function on History.
+
+ Loader no longer needs a loadingComplete callback, since it can just
+ initialize the history object itself.
+
+ * TestResultServer/static-dashboards/aggregate_results.js:
+ (handleValidHashParameter):
+ * TestResultServer/static-dashboards/dashboard_base.js:
+ * TestResultServer/static-dashboards/flakiness_dashboard.js:
+ (generatePage):
+ (.switch.return):
+ (handleQueryParameterChange):
+ * TestResultServer/static-dashboards/flakiness_dashboard_unittests.js:
+ (resetGlobals):
+ * TestResultServer/static-dashboards/history.js:
+ (.):
+ * TestResultServer/static-dashboards/loader.js:
+ (.):
+ * TestResultServer/static-dashboards/loader_unittests.js:
+ * TestResultServer/static-dashboards/timeline_explorer.js:
+ (generatePage):
+ (initCurrentBuilderTestResults):
+ * TestResultServer/static-dashboards/treemap.js:
+ (generatePage):
+ (.switch.return):
+ (handleQueryParameterChange):
+
2013-04-02 Sheriff Bot <[email protected]>
Unreviewed, rolling out r147401.
Modified: trunk/Tools/TestResultServer/static-dashboards/aggregate_results.js (147456 => 147457)
--- trunk/Tools/TestResultServer/static-dashboards/aggregate_results.js 2013-04-02 17:58:16 UTC (rev 147456)
+++ trunk/Tools/TestResultServer/static-dashboards/aggregate_results.js 2013-04-02 17:59:14 UTC (rev 147457)
@@ -34,10 +34,7 @@
// -copy them to the appropriate location
// -add the builder name to the list of builders in dashboard_base.js.
-//////////////////////////////////////////////////////////////////////////////
-// Methods and objects from dashboard_base.js to override.
-//////////////////////////////////////////////////////////////////////////////
-function generatePage()
+function generatePage(historyInstance)
{
var html = ui.html.testTypeSwitcher(true) + '<br>';
for (var builder in currentBuilders())
@@ -45,11 +42,11 @@
document.body.innerHTML = html;
}
-function handleValidHashParameter(key, value)
+function handleValidHashParameter(historyInstance, key, value)
{
switch(key) {
case 'rawValues':
- g_history.dashboardSpecificState[key] = value == 'true';
+ historyInstance.dashboardSpecificState[key] = value == 'true';
return true;
default:
@@ -57,10 +54,21 @@
}
}
-g_defaultDashboardSpecificStateValues = {
+var defaultDashboardSpecificStateValues = {
rawValues: false
};
+
+var aggregateResultsConfig = {
+ defaultStateValues: defaultDashboardSpecificStateValues,
+ generatePage: generatePage,
+ handleValidHashParameter: handleValidHashParameter,
+};
+
+// FIXME(jparent): Eventually remove all usage of global history object.
+var g_history = new history.History(aggregateResultsConfig);
+g_history.parseCrossDashboardParameters();
+
function htmlForBuilder(builder)
{
var results = g_resultsByBuilder[builder];
@@ -267,6 +275,6 @@
}
window.addEventListener('load', function() {
- var resourceLoader = new loader.Loader(intializeHistory);
+ var resourceLoader = new loader.Loader();
resourceLoader.load();
}, false);
Modified: trunk/Tools/TestResultServer/static-dashboards/dashboard_base.js (147456 => 147457)
--- trunk/Tools/TestResultServer/static-dashboards/dashboard_base.js 2013-04-02 17:58:16 UTC (rev 147456)
+++ trunk/Tools/TestResultServer/static-dashboards/dashboard_base.js 2013-04-02 17:59:14 UTC (rev 147457)
@@ -29,37 +29,8 @@
// @fileoverview Base JS file for pages that want to parse the results JSON
// from the testing bots. This deals with generic utility functions, visible
// history, popups and appending the script elements for the JSON files.
-//
-// The calling page is expected to implement the following "abstract"
-// functions/objects:
-// Generates the contents of the dashboard. The page should override this with
-// a function that generates the page assuming all resources have loaded.
-function generatePage() {}
-// Takes a key and a value and sets the g_history.dashboardSpecificState[key] = value iff key is
-// a valid hash parameter and the value is a valid value for that key.
-//
-// @return {boolean} Whether the key what inserted into the g_history.dashboardSpecificState.
-function handleValidHashParameter(key, value)
-{
- return false;
-}
-
-// Default hash parameters for the page. The page should override this to create
-// default states.
-var g_defaultDashboardSpecificStateValues = {};
-
-
-// The page should override this to modify page state due to
-// changing query parameters.
-// @param {Object} params New or modified query params as key: value.
-// @return {boolean} Whether changing this parameter should cause generatePage to be called.
-function handleQueryParameterChange(params)
-{
- return true;
-}
-
//////////////////////////////////////////////////////////////////////////////
// CONSTANTS
//////////////////////////////////////////////////////////////////////////////
@@ -84,11 +55,6 @@
'O': 'MISSING'
};
-// Map of parameter to other parameter it invalidates.
-var CROSS_DB_INVALIDATING_PARAMETERS = {
- 'testType': 'group'
-};
-var DB_SPECIFIC_INVALIDATING_PARAMETERS;
// Keys in the JSON files.
var WONTFIX_COUNTS_KEY = 'wontfixCounts';
@@ -167,25 +133,6 @@
return document.getElementById(id);
}
-function parseDashboardSpecificParameters()
-{
- g_history.dashboardSpecificState = {};
- var parameters = history.queryHashAsMap();
- for (parameterName in g_defaultDashboardSpecificStateValues)
- g_history.parseParameter(parameters, parameterName);
-}
-
-function defaultValue(key)
-{
- if (key in g_defaultDashboardSpecificStateValues)
- return g_defaultDashboardSpecificStateValues[key];
- return history.DEFAULT_CROSS_DASHBOARD_STATE_VALUES[key];
-}
-
-// TODO(jparent): Each db should create their own history obj, not global.
-var g_history = new history.History();
-g_history.parseCrossDashboardParameters();
-
function currentBuilderGroupCategory()
{
switch (g_history.crossDashboardState.testType) {
@@ -236,18 +183,6 @@
return string.endsWith(window.location.pathname, 'flakiness_dashboard.html');
}
-function handleLocationChange()
-{
- if (g_history.parseParameters())
- generatePage();
-}
-
-// TODO(jparent): Move this to upcoming History object.
-function intializeHistory() {
- window._onhashchange_ = handleLocationChange;
- handleLocationChange();
-}
-
// Create a new function with some of its arguements
// pre-filled.
// Taken from goog.partial in the Closure library.
Modified: trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard.js (147456 => 147457)
--- trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard.js 2013-04-02 17:58:16 UTC (rev 147456)
+++ trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard.js 2013-04-02 17:59:14 UTC (rev 147457)
@@ -136,12 +136,9 @@
var resourceLoader;
-//////////////////////////////////////////////////////////////////////////////
-// Methods and objects from dashboard_base.js to override.
-//////////////////////////////////////////////////////////////////////////////
-function generatePage()
+function generatePage(historyInstance)
{
- if (g_history.crossDashboardState.useTestData)
+ if (historyInstance.crossDashboardState.useTestData)
return;
document.body.innerHTML = '<div id="loading-ui">LOADING...</div>';
@@ -149,12 +146,12 @@
// tests expands to all tests that match the CSV list.
// result expands to all tests that ever have the given result
- if (g_history.dashboardSpecificState.tests || g_history.dashboardSpecificState.result)
+ if (historyInstance.dashboardSpecificState.tests || historyInstance.dashboardSpecificState.result)
generatePageForIndividualTests(individualTests());
- else if (g_history.dashboardSpecificState.expectationsUpdate)
+ else if (historyInstance.dashboardSpecificState.expectationsUpdate)
generatePageForExpectationsUpdate();
else
- generatePageForBuilder(g_history.dashboardSpecificState.builder || currentBuilderGroup().defaultBuilder());
+ generatePageForBuilder(historyInstance.dashboardSpecificState.builder || currentBuilderGroup().defaultBuilder());
for (var builder in currentBuilders())
processTestResultsForBuilderAsync(builder);
@@ -162,11 +159,11 @@
postHeightChangedMessage();
}
-function handleValidHashParameter(key, value)
+function handleValidHashParameter(historyInstance, key, value)
{
switch(key) {
case 'tests':
- history.validateParameter(g_history.dashboardSpecificState, key, value,
+ history.validateParameter(historyInstance.dashboardSpecificState, key, value,
function() {
return string.isValidName(value);
});
@@ -174,7 +171,7 @@
case 'result':
value = value.toUpperCase();
- history.validateParameter(g_history.dashboardSpecificState, key, value,
+ history.validateParameter(historyInstance.dashboardSpecificState, key, value,
function() {
for (var result in LAYOUT_TEST_EXPECTATIONS_MAP_) {
if (value == LAYOUT_TEST_EXPECTATIONS_MAP_[result])
@@ -185,7 +182,7 @@
return true;
case 'builder':
- history.validateParameter(g_history.dashboardSpecificState, key, value,
+ history.validateParameter(historyInstance.dashboardSpecificState, key, value,
function() {
return value in currentBuilders();
});
@@ -193,10 +190,10 @@
return true;
case 'sortColumn':
- history.validateParameter(g_history.dashboardSpecificState, key, value,
+ history.validateParameter(historyInstance.dashboardSpecificState, key, value,
function() {
// Get all possible headers since the actual used set of headers
- // depends on the values in g_history.dashboardSpecificState, which are currently being set.
+ // depends on the values in historyInstance.dashboardSpecificState, which are currently being set.
var headers = tableHeaders(true);
for (var i = 0; i < headers.length; i++) {
if (value == sortColumnFromTableHeader(headers[i]))
@@ -207,7 +204,7 @@
return true;
case 'sortOrder':
- history.validateParameter(g_history.dashboardSpecificState, key, value,
+ history.validateParameter(historyInstance.dashboardSpecificState, key, value,
function() {
return value == FORWARD || value == BACKWARD;
});
@@ -216,7 +213,7 @@
case 'resultsHeight':
case 'updateIndex':
case 'revision':
- history.validateParameter(g_history.dashboardSpecificState, key, Number(value),
+ history.validateParameter(historyInstance.dashboardSpecificState, key, Number(value),
function() {
return value.match(/^\d+$/);
});
@@ -234,7 +231,7 @@
case 'showUnexpectedPasses':
case 'showWontFixSkip':
case 'expectationsUpdate':
- g_history.dashboardSpecificState[key] = value == 'true';
+ historyInstance.dashboardSpecificState[key] = value == 'true';
return true;
default:
@@ -242,7 +239,27 @@
}
}
-g_defaultDashboardSpecificStateValues = {
+// @param {Object} params New or modified query parameters as key: value.
+function handleQueryParameterChange(historyInstance, params)
+{
+ for (key in params) {
+ if (key == 'tests') {
+ // Entering cross-builder view, only keep valid keys for that view.
+ for (var currentKey in historyInstance.dashboardSpecificState) {
+ if (isInvalidKeyForCrossBuilderView(currentKey)) {
+ delete historyInstance.dashboardSpecificState[currentKey];
+ }
+ }
+ } else if (isInvalidKeyForCrossBuilderView(key)) {
+ delete historyInstance.dashboardSpecificState.tests;
+ delete historyInstance.dashboardSpecificState.result;
+ }
+ }
+
+ return true;
+}
+
+var defaultDashboardSpecificStateValues = {
sortOrder: BACKWARD,
sortColumn: 'flakiness',
showExpectations: false,
@@ -265,12 +282,25 @@
builder: null
};
-DB_SPECIFIC_INVALIDATING_PARAMETERS = {
+var DB_SPECIFIC_INVALIDATING_PARAMETERS = {
'tests' : 'builder',
'testType': 'builder',
'group': 'builder'
};
+
+var flakinessConfig = {
+ defaultStateValues: defaultDashboardSpecificStateValues,
+ generatePage: generatePage,
+ handleValidHashParameter: handleValidHashParameter,
+ handleQueryParameterChange: handleQueryParameterChange,
+ invalidatingHashParameters: DB_SPECIFIC_INVALIDATING_PARAMETERS
+};
+
+// FIXME(jparent): Eventually remove all usage of global history object.
+var g_history = new history.History(flakinessConfig);
+g_history.parseCrossDashboardParameters();
+
//////////////////////////////////////////////////////////////////////////////
// GLOBALS
//////////////////////////////////////////////////////////////////////////////
@@ -2492,27 +2522,6 @@
return !(key in VALID_KEYS_FOR_CROSS_BUILDER_VIEW) && !(key in history.DEFAULT_CROSS_DASHBOARD_STATE_VALUES);
}
-// Sets the page state to regenerate the page.
-// @param {Object} params New or modified query parameters as key: value.
-function handleQueryParameterChange(params)
-{
- for (key in params) {
- if (key == 'tests') {
- // Entering cross-builder view, only keep valid keys for that view.
- for (var currentKey in g_history.dashboardSpecificState) {
- if (isInvalidKeyForCrossBuilderView(currentKey)) {
- delete g_history.dashboardSpecificState[currentKey];
- }
- }
- } else if (isInvalidKeyForCrossBuilderView(key)) {
- delete g_history.dashboardSpecificState.tests;
- delete g_history.dashboardSpecificState.result;
- }
- }
-
- return true;
-}
-
function hideLegend()
{
var legend = $('legend');
@@ -2606,6 +2615,6 @@
}, false);
window.addEventListener('load', function() {
- resourceLoader = new loader.Loader(intializeHistory);
+ resourceLoader = new loader.Loader();
resourceLoader.load();
}, false);
Modified: trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_unittests.js (147456 => 147457)
--- trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_unittests.js 2013-04-02 17:58:16 UTC (rev 147456)
+++ trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_unittests.js 2013-04-02 17:59:14 UTC (rev 147457)
@@ -35,7 +35,7 @@
g_resultsByBuilder = {};
g_allExpectations = null;
g_allTestsTrie = null;
- var historyInstance = new history.History();
+ var historyInstance = new history.History(flakinessConfig);
// FIXME(jparent): Remove this once global isn't used.
g_history = historyInstance;
g_testToResultsMap = {};
@@ -145,7 +145,7 @@
});
test('platformAndBuildType', 78, function() {
- var historyInstance = new history.History();
+ var historyInstance = new history.History(flakinessConfig);
// FIXME(jparent): Change to use the flakiness_db's history object
// once it exists, rather than tracking global.
g_history = historyInstance;
@@ -312,7 +312,7 @@
});
test('substringList', 2, function() {
- var historyInstance = new history.History();
+ var historyInstance = new history.History(flakinessConfig);
// FIXME(jparent): Remove this once global isn't used.
g_history = historyInstance;
historyInstance.crossDashboardState.testType = 'gtest';
@@ -325,7 +325,7 @@
});
test('htmlForTestsWithExpectationsButNoFailures', 4, function() {
- var historyInstance = new history.History();
+ var historyInstance = new history.History(defaultDashboardSpecificStateValues, generatePage, handleValidHashParameter);
// FIXME(jparent): Remove this once global isn't used.
g_history = historyInstance;
loadBuildersList('@ToT - chromium.org', 'layout-tests');
@@ -361,7 +361,7 @@
});
test('htmlForTestTypeSwitcherGroup', 6, function() {
- var historyInstance = new history.History();
+ var historyInstance = new history.History(flakinessConfig);
// FIXME(jparent): Remove this once global isn't used.
g_history = historyInstance;
var container = document.createElement('div');
@@ -701,7 +701,7 @@
});
test('shouldHideTest', 10, function() {
- var historyInstance = new history.History();
+ var historyInstance = new history.History(flakinessConfig);
historyInstance.parseParameters();
// FIXME(jparent): Change to use the flakiness_dashboard's history object
// once it exists, rather than tracking global.
Modified: trunk/Tools/TestResultServer/static-dashboards/history.js (147456 => 147457)
--- trunk/Tools/TestResultServer/static-dashboards/history.js 2013-04-02 17:58:16 UTC (rev 147456)
+++ trunk/Tools/TestResultServer/static-dashboards/history.js 2013-04-02 17:59:14 UTC (rev 147457)
@@ -106,15 +106,32 @@
}
}
-history.History = function()
+history.History = function(configuration)
{
- this.crossDashboardState = {};
- this.dashboardSpecificState = {};
+ this.crossDashboardState = {};
+ this.dashboardSpecificState = {};
+
+ if (configuration) {
+ this._defaultDashboardSpecificStateValues = configuration.defaultStateValues;
+ this._handleValidHashParameter = configuration.handleValidHashParameter;
+ this._handleQueryParameterChange = configuration.handleQueryParameterChange || function(historyInstance, params) { return true; };
+ this._dashboardSpecificInvalidatingParameters = configuration.invalidatingHashParameters;
+ this._generatePage = configuration.generatePage;
+ }
}
var RELOAD_REQUIRING_PARAMETERS = ['showAllRuns', 'group', 'testType'];
+var CROSS_DB_INVALIDATING_PARAMETERS = {
+ 'testType': 'group'
+};
+
history.History.prototype = {
+ initialize: function()
+ {
+ window._onhashchange_ = this._handleLocationChange.bind(this);
+ this._handleLocationChange();
+ },
isLayoutTestResults: function()
{
return this.crossDashboardState.testType == 'layout-tests';
@@ -132,6 +149,13 @@
history._fillMissingValues(this.crossDashboardState, history.DEFAULT_CROSS_DASHBOARD_STATE_VALUES);
},
+ _parseDashboardSpecificParameters: function()
+ {
+ this.dashboardSpecificState = {};
+ var parameters = history.queryHashAsMap();
+ for (parameterName in this._defaultDashboardSpecificStateValues)
+ this.parseParameter(parameters, parameterName);
+ },
// TODO(jparent): Make private once callers move here.
parseParameters: function()
{
@@ -150,10 +174,10 @@
}
}
- parseDashboardSpecificParameters();
+ this._parseDashboardSpecificParameters();
var dashboardSpecificDiffState = history._diffStates(oldDashboardSpecificState, this.dashboardSpecificState);
- history._fillMissingValues(this.dashboardSpecificState, g_defaultDashboardSpecificStateValues);
+ history._fillMissingValues(this.dashboardSpecificState, this._defaultDashboardSpecificStateValues);
// FIXME: dashboard_base shouldn't know anything about specific dashboard specific keys.
if (dashboardSpecificDiffState.builder)
@@ -163,7 +187,7 @@
var shouldGeneratePage = true;
if (Object.keys(dashboardSpecificDiffState).length)
- shouldGeneratePage = handleQueryParameterChange(dashboardSpecificDiffState);
+ shouldGeneratePage = this._handleQueryParameterChange(this, dashboardSpecificDiffState);
return shouldGeneratePage;
},
// TODO(jparent): Make private once callers move here.
@@ -205,7 +229,7 @@
return true;
default:
- return handleValidHashParameter(key, value);
+ return this._handleValidHashParameter(this, key, value);
}
},
queryParameterValue: function(parameter)
@@ -243,8 +267,8 @@
for (var key in queryParamsAsState) {
if (key in CROSS_DB_INVALIDATING_PARAMETERS)
delete this.crossDashboardState[CROSS_DB_INVALIDATING_PARAMETERS[key]];
- if (DB_SPECIFIC_INVALIDATING_PARAMETERS && key in DB_SPECIFIC_INVALIDATING_PARAMETERS)
- delete this.dashboardSpecificState[DB_SPECIFIC_INVALIDATING_PARAMETERS[key]];
+ if (this._dashboardSpecificInvalidatingParameters && key in this._dashboardSpecificInvalidatingParameters)
+ delete this.dashboardSpecificState[this._dashboardSpecificInvalidatingParameters[key]];
}
},
_joinParameters: function(stateObject)
@@ -252,7 +276,7 @@
var state = [];
for (var key in stateObject) {
var value = stateObject[key];
- if (value != defaultValue(key))
+ if (value != this._defaultValue(key))
state.push(key + '=' + encodeURIComponent(value));
}
return state.join('&');
@@ -268,7 +292,19 @@
for (var key in this.crossDashboardState)
combinedState[key] = this.crossDashboardState[key];
return combinedState;
+ },
+ _defaultValue: function(key)
+ {
+ if (key in this._defaultDashboardSpecificStateValues)
+ return this._defaultDashboardSpecificStateValues[key];
+ return history.DEFAULT_CROSS_DASHBOARD_STATE_VALUES[key];
+ },
+ _handleLocationChange: function()
+ {
+ if (this.parseParameters())
+ this._generatePage(this);
}
+
}
})();
\ No newline at end of file
Modified: trunk/Tools/TestResultServer/static-dashboards/loader.js (147456 => 147457)
--- trunk/Tools/TestResultServer/static-dashboards/loader.js 2013-04-02 17:58:16 UTC (rev 147456)
+++ trunk/Tools/TestResultServer/static-dashboards/loader.js 2013-04-02 17:59:14 UTC (rev 147457)
@@ -57,7 +57,7 @@
xhr.send();
}
-loader.Loader = function(opt_onLoadingComplete)
+loader.Loader = function()
{
this._loadingSteps = [
this._loadBuildersList,
@@ -68,7 +68,6 @@
this._buildersThatFailedToLoad = [];
this._staleBuilders = [];
this._errors = new ui.Errors();
- this._onLoadingComplete = opt_onLoadingComplete || function() {};
// TODO(jparent): Pass in the appropriate history obj per db.
this._history = g_history;
}
@@ -107,7 +106,7 @@
var loadingStep = this._loadingSteps.shift();
if (!loadingStep) {
this._addErrors();
- this._onLoadingComplete();
+ this._history.initialize();
return;
}
loadingStep.apply(this);
Modified: trunk/Tools/TestResultServer/static-dashboards/loader_unittests.js (147456 => 147457)
--- trunk/Tools/TestResultServer/static-dashboards/loader_unittests.js 2013-04-02 17:58:16 UTC (rev 147456)
+++ trunk/Tools/TestResultServer/static-dashboards/loader_unittests.js 2013-04-02 17:59:14 UTC (rev 147457)
@@ -31,11 +31,10 @@
test('loading steps', 1, function() {
resetGlobals();
var loadedSteps = [];
- var loadingCompleteCallback = handleLocationChange;
- handleLocationChange = function() {
+ g_history._handleLocationChange = function() {
deepEqual(loadedSteps, ['step 1', 'step 2']);
}
- var resourceLoader = new loader.Loader(handleLocationChange);
+ var resourceLoader = new loader.Loader();
function loadingStep1() {
loadedSteps.push('step 1');
resourceLoader.load();
@@ -48,9 +47,7 @@
try {
resourceLoader._loadingSteps = [loadingStep1, loadingStep2];
resourceLoader.load();
- } finally {
- handleLocationChange = loadingCompleteCallback;
- }
+ }
});
// Total number of assertions is 1 for the deepEqual of the builder lists
Modified: trunk/Tools/TestResultServer/static-dashboards/timeline_explorer.js (147456 => 147457)
--- trunk/Tools/TestResultServer/static-dashboards/timeline_explorer.js 2013-04-02 17:58:16 UTC (rev 147456)
+++ trunk/Tools/TestResultServer/static-dashboards/timeline_explorer.js 2013-04-02 17:59:14 UTC (rev 147457)
@@ -32,21 +32,29 @@
var g_currentBuildIndex = -1;
var g_currentBuilderTestResults;
-//////////////////////////////////////////////////////////////////////////////
-// Methods and objects from dashboard_base.js to override.
-//////////////////////////////////////////////////////////////////////////////
-function generatePage()
+var defaultDashboardSpecificStateValues = {
+ builder: null,
+ buildTimestamp: -1,
+ ignoreFlakyTests: true
+};
+
+var DB_SPECIFIC_INVALIDATING_PARAMETERS = {
+ 'testType': 'builder',
+ 'group': 'builder'
+};
+
+function generatePage(historyInstance)
{
g_buildIndicesByTimestamp = {};
- var results = g_resultsByBuilder[g_history.dashboardSpecificState.builder || currentBuilderGroup().defaultBuilder()];
+ var results = g_resultsByBuilder[historyInstance.dashboardSpecificState.builder || currentBuilderGroup().defaultBuilder()];
for (var i = 0; i < results[FIXABLE_COUNTS_KEY].length; i++) {
var buildDate = new Date(results[TIMESTAMPS_KEY][i] * 1000);
g_buildIndicesByTimestamp[buildDate.getTime()] = i;
}
- if (g_history.dashboardSpecificState.buildTimestamp != -1 && g_history.dashboardSpecificState.buildTimestamp in g_buildIndicesByTimestamp) {
- var newBuildIndex = g_buildIndicesByTimestamp[g_history.dashboardSpecificState.buildTimestamp];
+ if (historyInstance.dashboardSpecificState.buildTimestamp != -1 && historyInstance.dashboardSpecificState.buildTimestamp in g_buildIndicesByTimestamp) {
+ var newBuildIndex = g_buildIndicesByTimestamp[historyInstance.dashboardSpecificState.buildTimestamp];
if (newBuildIndex == g_currentBuildIndex) {
// This happens when selectBuild is called, which updates the UI
@@ -61,48 +69,48 @@
initCurrentBuilderTestResults();
$('test-type-switcher').innerHTML = ui.html.testTypeSwitcher( false,
- ui.html.checkbox('ignoreFlakyTests', 'Ignore flaky tests', g_history.dashboardSpecificState.ignoreFlakyTests, 'g_currentBuildIndex = -1')
+ ui.html.checkbox('ignoreFlakyTests', 'Ignore flaky tests', historyInstance.dashboardSpecificState.ignoreFlakyTests, 'g_currentBuildIndex = -1')
);
updateTimelineForBuilder();
}
-function initCurrentBuilderTestResults()
+function handleValidHashParameter(historyInstance, key, value)
{
- var startTime = Date.now();
- g_currentBuilderTestResults = _decompressResults(g_resultsByBuilder[g_history.dashboardSpecificState.builder || currentBuilderGroup().defaultBuilder()]);
- console.log( 'Time to get test results by build: ' + (Date.now() - startTime));
-}
-
-function handleValidHashParameter(key, value)
-{
switch(key) {
case 'builder':
- history.validateParameter(g_history.dashboardSpecificState, key, value,
+ history.validateParameter(historyInstance.dashboardSpecificState, key, value,
function() { return value in currentBuilders(); });
return true;
case 'buildTimestamp':
- g_history.dashboardSpecificState.buildTimestamp = parseInt(value, 10);
+ historyInstance.dashboardSpecificState.buildTimestamp = parseInt(value, 10);
return true;
case 'ignoreFlakyTests':
- g_history.dashboardSpecificState.ignoreFlakyTests = value == 'true';
+ historyInstance.dashboardSpecificState.ignoreFlakyTests = value == 'true';
return true;
default:
return false;
}
}
-g_defaultDashboardSpecificStateValues = {
- builder: null,
- buildTimestamp: -1,
- ignoreFlakyTests: true
+var timelineConfig = {
+ defaultStateValues: defaultDashboardSpecificStateValues,
+ generatePage: generatePage,
+ handleValidHashParameter: handleValidHashParameter,
+ invalidatingHashParameters: DB_SPECIFIC_INVALIDATING_PARAMETERS
};
-DB_SPECIFIC_INVALIDATING_PARAMETERS = {
- 'testType': 'builder',
- 'group': 'builder'
-};
+// FIXME(jparent): Eventually remove all usage of global history object.
+var g_history = new history.History(timelineConfig);
+g_history.parseCrossDashboardParameters();
+function initCurrentBuilderTestResults()
+{
+ var startTime = Date.now();
+ g_currentBuilderTestResults = _decompressResults(g_resultsByBuilder[g_history.dashboardSpecificState.builder || currentBuilderGroup().defaultBuilder()]);
+ console.log( 'Time to get test results by build: ' + (Date.now() - startTime));
+}
+
function shouldShowWebKitRevisionsOnly()
{
return isTipOfTreeWebKitBuilder();
@@ -488,6 +496,6 @@
});
window.addEventListener('load', function() {
- var resourceLoader = new loader.Loader(intializeHistory);
+ var resourceLoader = new loader.Loader();
resourceLoader.load();
}, false);
Modified: trunk/Tools/TestResultServer/static-dashboards/treemap.js (147456 => 147457)
--- trunk/Tools/TestResultServer/static-dashboards/treemap.js 2013-04-02 17:58:16 UTC (rev 147456)
+++ trunk/Tools/TestResultServer/static-dashboards/treemap.js 2013-04-02 17:59:14 UTC (rev 147457)
@@ -26,6 +26,77 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+var defaultDashboardSpecificStateValues = {
+ builder: null,
+ treemapfocus: '',
+};
+
+var DB_SPECIFIC_INVALIDATING_PARAMETERS = {
+ 'testType': 'builder',
+ 'group': 'builder'
+};
+
+function generatePage(historyInstance)
+{
+ $('header-container').innerHTML = ui.html.testTypeSwitcher();
+
+ g_isGeneratingPage = true;
+
+ var rawTree = g_resultsByBuilder[historyInstance.dashboardSpecificState.builder || currentBuilderGroup().defaultBuilder()];
+ g_webTree = convertToWebTreemapFormat('LayoutTests', rawTree);
+ appendTreemap($('map'), g_webTree);
+
+ if (historyInstance.dashboardSpecificState.treemapfocus)
+ focusPath(g_webTree, historyInstance.dashboardSpecificState.treemapfocus)
+
+ g_isGeneratingPage = false;
+}
+
+function handleValidHashParameter(historyInstance, key, value)
+{
+ switch(key) {
+ case 'builder':
+ history.validateParameter(historyInstance.dashboardSpecificState, key, value,
+ function() { return value in currentBuilders(); });
+ return true;
+
+ case 'treemapfocus':
+ history.validateParameter(historyInstance.dashboardSpecificState, key, value,
+ function() {
+ // FIXME: There's probably a simpler regexp here. Just trying to match ascii + forward-slash.
+ // e.g. LayoutTests/foo/bar.html
+ return (value.match(/^(\w+\/\w*)*$/));
+ });
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+function handleQueryParameterChange(historyInstance, params)
+{
+ for (var param in params) {
+ if (param != 'treemapfocus') {
+ $('map').innerHTML = 'Loading...';
+ return true;
+ }
+ }
+ return false;
+}
+
+var treemapConfig = {
+ defaultStateValues: defaultDashboardSpecificStateValues,
+ generatePage: generatePage,
+ handleValidHashParameter: handleValidHashParameter,
+ handleQueryParameterChange: handleQueryParameterChange,
+ invalidatingHashParameters: DB_SPECIFIC_INVALIDATING_PARAMETERS
+};
+
+// FIXME(jparent): Eventually remove all usage of global history object.
+var g_history = new history.History(treemapConfig);
+g_history.parseCrossDashboardParameters();
+
var TEST_URL_BASE_PATH = "http://svn.webkit.org/repository/webkit/trunk/";
function humanReadableTime(milliseconds)
@@ -136,22 +207,6 @@
var g_isGeneratingPage = false;
var g_webTree;
-function generatePage()
-{
- $('header-container').innerHTML = ui.html.testTypeSwitcher();
-
- g_isGeneratingPage = true;
-
- var rawTree = g_resultsByBuilder[g_history.dashboardSpecificState.builder || currentBuilderGroup().defaultBuilder()];
- g_webTree = convertToWebTreemapFormat('LayoutTests', rawTree);
- appendTreemap($('map'), g_webTree);
-
- if (g_history.dashboardSpecificState.treemapfocus)
- focusPath(g_webTree, g_history.dashboardSpecificState.treemapfocus)
-
- g_isGeneratingPage = false;
-}
-
function focusPath(tree, path)
{
var parts = decodeURIComponent(path).split('/');
@@ -178,49 +233,6 @@
}
-function handleValidHashParameter(key, value)
-{
- switch(key) {
- case 'builder':
- history.validateParameter(g_history.dashboardSpecificState, key, value,
- function() { return value in currentBuilders(); });
- return true;
-
- case 'treemapfocus':
- history.validateParameter(g_history.dashboardSpecificState, key, value,
- function() {
- // FIXME: There's probably a simpler regexp here. Just trying to match ascii + forward-slash.
- // e.g. LayoutTests/foo/bar.html
- return (value.match(/^(\w+\/\w*)*$/));
- });
- return true;
-
- default:
- return false;
- }
-}
-
-g_defaultDashboardSpecificStateValues = {
- builder: null,
- treemapfocus: '',
-};
-
-DB_SPECIFIC_INVALIDATING_PARAMETERS = {
- 'testType': 'builder',
- 'group': 'builder'
-};
-
-function handleQueryParameterChange(params)
-{
- for (var param in params) {
- if (param != 'treemapfocus') {
- $('map').innerHTML = 'Loading...';
- return true;
- }
- }
- return false;
-}
-
function extractName(node)
{
return node.name.split(' ')[0];
@@ -270,6 +282,6 @@
}
window.addEventListener('load', function() {
- var resourceLoader = new loader.Loader(intializeHistory);
+ var resourceLoader = new loader.Loader();
resourceLoader.load();
}, false);