Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Tools / TestResultServer / static-dashboards / flakiness_dashboard_unittests.js
1 // Copyright (C) 2011 Google Inc. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //     * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //     * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //     * Neither the name of Google Inc. nor the names of its
14 // contributors may be used to endorse or promote products derived from
15 // this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 module('flakiness_dashboard');
30
31 // FIXME(jparent): Rename this once it isn't globals.
32 function resetGlobals()
33 {
34     allExpectations = null;
35     g_resultsByBuilder = {};
36     g_allTestsTrie = null;
37     var historyInstance = new history.History(flakinessConfig);
38     // FIXME(jparent): Remove this once global isn't used.
39     g_history = historyInstance;
40     g_testToResultsMap = {};
41
42     for (var key in history.DEFAULT_CROSS_DASHBOARD_STATE_VALUES)
43         historyInstance.crossDashboardState[key] = history.DEFAULT_CROSS_DASHBOARD_STATE_VALUES[key];
44
45     LOAD_BUILDBOT_DATA({
46         "no_upload_test_types": [
47             "webkit_unit_tests"
48         ],
49         'masters': [{
50             name: 'ChromiumWebkit',
51             url_name: "chromium.webkit",
52             tests: {
53                 'layout-tests': {'builders': ['WebKit Linux', 'WebKit Linux (dbg)', 'WebKit Linux (deps)', 'WebKit Mac10.7', 'WebKit Win', 'WebKit Win (dbg)']},
54                 'unit_tests': {'builders': ['Linux Tests']},
55             },
56             groups: ['@ToT Chromium', '@ToT Blink'],
57         },{
58             name :'ChromiumWin',
59             url_name: "chromium.win",
60             tests: {
61                 'ash_unittests': {'builders': ['XP Tests (1)', 'Win7 Tests (1)']},
62                 'unit_tests': {'builders': ['Linux Tests']},
63             },
64             groups: ['@ToT Chromium'],
65         }],
66     });
67
68    return historyInstance;
69 }
70
71 var FAILURE_MAP = {"A": "AUDIO", "C": "CRASH", "F": "TEXT", "I": "IMAGE", "O": "MISSING",
72     "N": "NO DATA", "P": "PASS", "T": "TIMEOUT", "Y": "NOTRUN", "X": "SKIP", "Z": "IMAGE+TEXT"}
73
74 test('splitTestList', 1, function() {
75     var historyInstance = new history.History(flakinessConfig);
76     // FIXME(jparent): Remove this once global isn't used.
77     g_history = historyInstance;
78     historyInstance.dashboardSpecificState.tests = 'test.foo test.foo1\ntest.foo2\ntest.foo3,foo\\bar\\baz.html';
79     equal(splitTestList().toString(), 'test.foo,test.foo1,test.foo2,test.foo3,foo/bar/baz.html');
80 });
81
82 test('headerForTestTableHtml', 1, function() {
83     var container = document.createElement('div');
84     container.innerHTML = headerForTestTableHtml();
85     equal(container.querySelectorAll('input').length, 4);
86 });
87
88 test('htmlForTestTypeSwitcherGroup', 6, function() {
89     resetGlobals();
90     var historyInstance = new history.History(flakinessConfig);
91     // FIXME(jparent): Remove this once global isn't used.
92     g_history = historyInstance;
93     var container = document.createElement('div');
94     historyInstance.crossDashboardState.testType = 'ash_unittests';
95     container.innerHTML = ui.html.testTypeSwitcher(true);
96     var selects = container.querySelectorAll('select');
97     equal(selects.length, 2);
98     var group = selects[1];
99     equal(group.parentNode.textContent.indexOf('Group:'), 0);
100     equal(group.children.length, 1);
101
102     historyInstance.crossDashboardState.testType = 'layout-tests';
103     container.innerHTML = ui.html.testTypeSwitcher(true);
104     var selects = container.querySelectorAll('select');
105     equal(selects.length, 2);
106     var group = selects[1];
107     equal(group.parentNode.textContent.indexOf('Group:'), 0);
108     equal(group.children.length, 2);
109 });
110
111 test('htmlForIndividualTestOnAllBuilders', 1, function() {
112     resetGlobals();
113     builders.loadBuildersList('@ToT Blink', 'layout-tests');
114     equal(htmlForIndividualTestOnAllBuilders('foo/nonexistant.html'), '<div class="not-found">Test not found. Either it does not exist, is skipped or passes on all recorded runs.</div>');
115 });
116
117 test('htmlForIndividualTestOnAllBuildersWithResultsLinksNonexistant', 1, function() {
118     resetGlobals();
119     builders.loadBuildersList('@ToT Blink', 'layout-tests');
120     equal(htmlForIndividualTestOnAllBuildersWithResultsLinks('foo/nonexistant.html'),
121         '<div class="not-found">Test not found. Either it does not exist, is skipped or passes on all recorded runs.</div>' +
122         '<div class=expectations test=foo/nonexistant.html>' +
123             '<div>' +
124                 '<span class=link onclick="g_history.setQueryParameter(\'showExpectations\', true)">Show results</span> | ' +
125                 '<span class=link onclick="g_history.setQueryParameter(\'showLargeExpectations\', true)">Show large thumbnails</span> | ' +
126                 '<b>Only shows actual results/diffs from the most recent *failure* on each bot.</b>' +
127             '</div>' +
128         '</div>');
129 });
130
131 test('htmlForIndividualTestOnAllBuildersWithResultsLinks', 1, function() {
132     resetGlobals();
133     builders.loadBuildersList('@ToT Blink', 'layout-tests');
134
135     var builderName = 'WebKit Linux';
136     g_resultsByBuilder[builderName] = {buildNumbers: [2, 1], blinkRevision: [1234, 1233], failure_map: FAILURE_MAP};
137
138     var test = 'dummytest.html';
139     var resultsObject = createResultsObjectForTest(test, builderName);
140     resultsObject.rawResults = [[1, 'F']];
141     resultsObject.rawTimes = [[1, 0]];
142     resultsObject.bugs = ["crbug.com/1234", "webkit.org/5678"];
143     g_testToResultsMap[test] = [resultsObject];
144
145     equal(htmlForIndividualTestOnAllBuildersWithResultsLinks(test),
146         '<table class=test-table><thead><tr>' +
147                 '<th sortValue=test><div class=table-header-content><span></span><span class=header-text>test</span></div></th>' +
148                 '<th sortValue=bugs><div class=table-header-content><span></span><span class=header-text>bugs</span></div></th>' +
149                 '<th sortValue=expectations><div class=table-header-content><span></span><span class=header-text>expectations</span></div></th>' +
150                 '<th sortValue=slowest><div class=table-header-content><span></span><span class=header-text>slowest run</span></div></th>' +
151                 '<th sortValue=flakiness colspan=10000><div class=table-header-content><span></span><span class=header-text>flakiness (numbers are runtimes in seconds)</span></div></th>' +
152             '</tr></thead>' +
153             '<tbody><tr>' +
154                 '<td class="test-link builder-name">WebKit Linux' +
155                 '<td class=options-container>' +
156                     '<div><a href="http://crbug.com/1234">crbug.com/1234</a></div>' +
157                     '<div><a href="http://webkit.org/5678">webkit.org/5678</a></div>' +
158                 '<td class=options-container><td>' +
159                 '<td title="TEXT. Click for more info." class="results TEXT" onclick=\'showPopupForBuild(event, "WebKit Linux",0,"dummytest.html")\'></td>' +
160                 '<td title="NO DATA. Click for more info." class="results NODATA" onclick=\'showPopupForBuild(event, "WebKit Linux",1,"dummytest.html")\'>?</td>' +
161             '</tbody>' +
162         '</table>' +
163         '<div>The following builders either don\'t run this test (e.g. it\'s skipped) or all recorded runs passed:</div>' +
164         '<div class=skipped-builder-list>' +
165             '<div class=skipped-builder>WebKit Linux (dbg)</div><div class=skipped-builder>WebKit Mac10.7</div><div class=skipped-builder>WebKit Win</div><div class=skipped-builder>WebKit Win (dbg)</div>' +
166         '</div>' +
167         '<div class=expectations test=dummytest.html>' +
168             '<div><span class=link onclick="g_history.setQueryParameter(\'showExpectations\', true)">Show results</span> | ' +
169             '<span class=link onclick="g_history.setQueryParameter(\'showLargeExpectations\', true)">Show large thumbnails</span> | ' +
170             '<b>Only shows actual results/diffs from the most recent *failure* on each bot.</b></div>' +
171         '</div>');
172 });
173
174 test('individualTestsForSubstringList', 2, function() {
175     var builderName = 'WebKit Linux';
176     g_resultsByBuilder[builderName] = {
177         buildNumbers: [2, 1],
178         blinkRevision: [1234, 1233],
179         failure_map: FAILURE_MAP,
180         tests: {
181             'foo/one.html': { results: [1, 'F'], times: [1, 0] },
182             'virtual/foo/one.html': { results: [1, 'F'], times: [1, 0] },
183         }
184     };
185
186     g_history.dashboardSpecificState.showChrome = true;
187     var testToMatch = 'foo/one.html';
188     g_history.dashboardSpecificState.tests = testToMatch;
189     deepEqual(individualTestsForSubstringList(), [testToMatch, 'virtual/foo/one.html']);
190
191     g_history.dashboardSpecificState.showChrome = false;
192     deepEqual(individualTestsForSubstringList(), [testToMatch]);
193 });
194
195 test('htmlForIndividualTest', 2, function() {
196     var historyInstance = resetGlobals();
197     builders.loadBuildersList('@ToT Blink', 'layout-tests');
198     var test = 'foo/nonexistant.html';
199
200     historyInstance.dashboardSpecificState.showChrome = false;
201
202     equal(htmlForIndividualTest(test), htmlForIndividualTestOnAllBuilders(test) +
203         '<div class=expectations test=foo/nonexistant.html>' +
204             '<div><span class=link onclick=\"g_history.setQueryParameter(\'showExpectations\', true)\">Show results</span> | ' +
205             '<span class=link onclick=\"g_history.setQueryParameter(\'showLargeExpectations\', true)\">Show large thumbnails</span> | ' +
206             '<b>Only shows actual results/diffs from the most recent *failure* on each bot.</b></div>' +
207         '</div>');
208
209     historyInstance.dashboardSpecificState.showChrome = true;
210
211     equal(htmlForIndividualTest(test),
212         '<h2><a href="' + TEST_URL_BASE_PATH_FOR_BROWSING + 'foo/nonexistant.html" target="_blank">foo/nonexistant.html</a></h2>' +
213         htmlForIndividualTestOnAllBuildersWithResultsLinks(test));
214 });
215
216 test('linkifyBugs', 4, function() {
217     equal(linkifyBugs(["crbug.com/1234", "webkit.org/5678"]),
218         '<div><a href="http://crbug.com/1234">crbug.com/1234</a></div><div><a href="http://webkit.org/5678">webkit.org/5678</a></div>');
219     equal(linkifyBugs(["crbug.com/1234"]), '<div><a href="http://crbug.com/1234">crbug.com/1234</a></div>');
220     equal(linkifyBugs(["Bug(nick)"]), '<div>Bug(nick)</div>');
221     equal(linkifyBugs([]), '');
222 });
223
224 test('htmlForSingleTestRow', 1, function() {
225     var historyInstance = resetGlobals();
226     var builder = 'dummyBuilder';
227     var test = createResultsObjectForTest('foo/exists.html', builder);
228     historyInstance.dashboardSpecificState.showNonFlaky = true;
229     var blinkRevisions = [1234, 1233];
230     g_resultsByBuilder[builder] = {buildNumbers: [2, 1], blinkRevision: blinkRevisions, failure_map: FAILURE_MAP};
231     test.rawResults = [[1, 'F'], [2, 'I']];
232     test.rawTimes = [[1, 0], [2, 5]];
233     var expected = '<tr>' +
234         '<td class="test-link"><span class="link" onclick="g_history.setQueryParameter(\'tests\',\'foo/exists.html\');">foo/exists.html</span>' +
235         '<td class=options-container><a class="file-new-bug" href="https://code.google.com/p/chromium/issues/entry?template=Layout%20Test%20Failure&summary=Layout%20Test%20foo%2Fexists.html%20is%20failing&comment=The%20following%20layout%20test%20is%20failing%20on%20%5Binsert%20platform%5D%0A%0Afoo%2Fexists.html%0A%0AProbable%20cause%3A%0A%0A%5Binsert%20probable%20cause%5D">File new bug</a>' +
236         '<td class=options-container>' +
237         '<td>' +
238         '<td title="TEXT. Click for more info." class="results TEXT" onclick=\'showPopupForBuild(event, "dummyBuilder",0,"foo/exists.html")\'></td>' +
239         '<td title="IMAGE. Click for more info." class="results IMAGE" onclick=\'showPopupForBuild(event, "dummyBuilder",1,"foo/exists.html")\'>5</td>';
240
241     equal(htmlForSingleTestRow(test, false, blinkRevisions), expected);
242 });
243
244 test('lookupVirtualTestSuite', 2, function() {
245     equal(lookupVirtualTestSuite('fast/canvas/foo.html'), '');
246     equal(lookupVirtualTestSuite('virtual/gpu/fast/canvas/foo.html'), 'virtual/gpu/fast/canvas');
247 });
248
249 test('baseTest', 2, function() {
250     equal(baseTest('fast/canvas/foo.html', ''), 'fast/canvas/foo.html');
251     equal(baseTest('virtual/gpu/fast/canvas/foo.html', 'virtual/gpu/fast/canvas'), 'fast/canvas/foo.html');
252 });
253
254 test('sortTests', 4, function() {
255     var test1 = createResultsObjectForTest('foo/test1.html', 'dummyBuilder');
256     var test2 = createResultsObjectForTest('foo/test2.html', 'dummyBuilder');
257     var test3 = createResultsObjectForTest('foo/test3.html', 'dummyBuilder');
258     test1.expectations = 'b';
259     test2.expectations = 'a';
260     test3.expectations = '';
261
262     var tests = [test1, test2, test3];
263     sortTests(tests, 'expectations', FORWARD);
264     deepEqual(tests, [test2, test1, test3]);
265     sortTests(tests, 'expectations', BACKWARD);
266     deepEqual(tests, [test3, test1, test2]);
267
268     test1.bugs = 'b';
269     test2.bugs = 'a';
270     test3.bugs = '';
271
272     var tests = [test1, test2, test3];
273     sortTests(tests, 'bugs', FORWARD);
274     deepEqual(tests, [test2, test1, test3]);
275     sortTests(tests, 'bugs', BACKWARD);
276     deepEqual(tests, [test3, test1, test2]);
277 });
278
279 test('popup', 2, function() {
280     ui.popup.show(document.body, 'dummy content');
281     ok(document.querySelector('#popup'));
282     ui.popup.hide();
283     ok(!document.querySelector('#popup'));
284 });
285
286 test('gpuResultsPath', 3, function() {
287   equal(gpuResultsPath('777777', 'Win7 Release (ATI)'), '777777_Win7_Release_ATI_');
288   equal(gpuResultsPath('123', 'GPU Linux (dbg)(NVIDIA)'), '123_GPU_Linux_dbg_NVIDIA_');
289   equal(gpuResultsPath('12345', 'GPU Mac'), '12345_GPU_Mac');
290 });
291
292 test('TestTrie', 3, function() {
293     var builders = {
294         "Dummy Chromium Windows Builder": true,
295         "Dummy GTK Linux Builder": true,
296         "Dummy Apple Mac Lion Builder": true
297     };
298
299     var resultsByBuilder = {
300         "Dummy Chromium Windows Builder": {
301             tests: {
302                 "foo": true,
303                 "foo/bar/1.html": true,
304                 "foo/bar/baz": true
305             }
306         },
307         "Dummy GTK Linux Builder": {
308             tests: {
309                 "bar": true,
310                 "foo/1.html": true,
311                 "foo/bar/2.html": true,
312                 "foo/bar/baz/1.html": true,
313             }
314         },
315         "Dummy Apple Mac Lion Builder": {
316             tests: {
317                 "foo/bar/3.html": true,
318                 "foo/bar/baz/foo": true,
319             }
320         }
321     };
322     var expectedTrie = {
323         "foo": {
324             "bar": {
325                 "1.html": true,
326                 "2.html": true,
327                 "3.html": true,
328                 "baz": {
329                     "1.html": true,
330                     "foo": true
331                 }
332             },
333             "1.html": true
334         },
335         "bar": true
336     }
337
338     var trie = new TestTrie(builders, resultsByBuilder);
339     deepEqual(trie._trie, expectedTrie);
340
341     var leafsOfCompleteTrieTraversal = [];
342     var expectedLeafs = ["foo/bar/1.html", "foo/bar/baz/1.html", "foo/bar/baz/foo", "foo/bar/2.html", "foo/bar/3.html", "foo/1.html", "bar"];
343     trie.forEach(function(triePath) {
344         leafsOfCompleteTrieTraversal.push(triePath);
345     });
346     deepEqual(leafsOfCompleteTrieTraversal, expectedLeafs);
347
348     var leafsOfPartialTrieTraversal = [];
349     expectedLeafs = ["foo/bar/1.html", "foo/bar/baz/1.html", "foo/bar/baz/foo", "foo/bar/2.html", "foo/bar/3.html"];
350     trie.forEach(function(triePath) {
351         leafsOfPartialTrieTraversal.push(triePath);
352     }, "foo/bar");
353     deepEqual(leafsOfPartialTrieTraversal, expectedLeafs);
354 });
355
356 test('changeTestTypeInvalidatesGroup', 1, function() {
357     var historyInstance = resetGlobals();
358     var originalGroup = '@ToT Blink';
359     var originalTestType = 'layout-tests';
360     builders.loadBuildersList(originalGroup, originalTestType);
361     historyInstance.crossDashboardState.group = originalGroup;
362     historyInstance.crossDashboardState.testType = originalTestType;
363
364     historyInstance.invalidateQueryParameters({'testType': 'ui_tests'});
365     notEqual(historyInstance.crossDashboardState.group, originalGroup, "group should have been invalidated");
366 });
367
368 test('shouldShowTest', 9, function() {
369     var historyInstance = new history.History(flakinessConfig);
370     historyInstance.parseParameters();
371     // FIXME(jparent): Change to use the flakiness_dashboard's history object
372     // once it exists, rather than tracking global.
373     g_history = historyInstance;
374     var test = createResultsObjectForTest('foo/test.html', 'dummyBuilder');
375
376     equal(shouldShowTest(test), false, 'default layout test, hide it.');
377     historyInstance.dashboardSpecificState.showNonFlaky = true;
378     equal(shouldShowTest(test), true, 'show correct expectations.');
379     historyInstance.dashboardSpecificState.showNonFlaky = false;
380
381     test = createResultsObjectForTest('foo/test.html', 'dummyBuilder');
382     test.expectations = "WONTFIX";
383     equal(shouldShowTest(test), false, 'by default hide wontfix');
384     historyInstance.dashboardSpecificState.showWontFix = true;
385     equal(shouldShowTest(test), true, 'show wontfix');
386     historyInstance.dashboardSpecificState.showWontFix = false;
387
388     test = createResultsObjectForTest('foo/test.html', 'dummyBuilder');
389     test.expectations = "SKIP";
390     equal(shouldShowTest(test), false, 'we hide skip tests by default');
391     historyInstance.dashboardSpecificState.showSkip = true;
392     equal(shouldShowTest(test), true, 'show skip test');
393     historyInstance.dashboardSpecificState.showSkip = false;
394
395     test = createResultsObjectForTest('foo/test.html', 'dummyBuilder');
396     test.isFlaky = true;
397     equal(shouldShowTest(test), false, 'hide flaky tests by default');
398     historyInstance.dashboardSpecificState.showFlaky = true;
399     equal(shouldShowTest(test), true, 'show flaky test');
400     historyInstance.dashboardSpecificState.showFlaky = false;
401
402     test = createResultsObjectForTest('foo/test.html', 'dummyBuilder');
403     historyInstance.crossDashboardState.testType = 'not layout tests';
404     equal(shouldShowTest(test), true, 'show all non layout tests');
405 });
406
407 test('collapsedRevisionListBlink', 1, function() {
408     resetGlobals();
409     builders.loadBuildersList('@ToT Blink', 'layout-tests');
410     var test = 'dummytest.html';
411
412     var builderName1 = 'WebKit Linux 1';
413     // Note: r1235 results were generated twice by two separate builds.
414     g_resultsByBuilder[builderName1] = {buildNumbers: [2, 1, 3, 4], blinkRevision: [1235, 1235, 1234, 1232], failure_map: FAILURE_MAP};
415
416     var builderName2 = 'WebKit Linux 2';
417     g_resultsByBuilder[builderName2] = {buildNumbers: [4, 5], blinkRevision: [1236, 1234], failure_map: FAILURE_MAP};
418
419     var resultsObject1 = createResultsObjectForTest(test, builderName1);
420     var resultsObject2 = createResultsObjectForTest(test, builderName2);
421
422     var result = collapsedRevisionList([resultsObject1, resultsObject2]).join(',');
423     var expected = [1236, 1235, 1235, 1234, 1232].join(',');
424     equal(result, expected, 'collapsedRevisionList result should be the unique blink builds, sorted in descending order');
425 });
426
427 test('collapsedRevisionListChromium', 1, function() {
428     resetGlobals();
429     g_history.crossDashboardState.group = '@ToT Chromium';
430     builders.loadBuildersList('@ToT Chromium', 'unit_tests');
431     var test = 'dummytest.html';
432
433     var builderName1 = 'WebKit Linux 1';
434     // Note: r1235 results were generated twice by two separate builds.
435     g_resultsByBuilder[builderName1] = {buildNumbers: [2, 1, 3, 4], chromeRevision: [1235, 1235, 1234, 1232], failure_map: FAILURE_MAP};
436
437     var builderName2 = 'WebKit Linux 2';
438     g_resultsByBuilder[builderName2] = {buildNumbers: [4, 5], chromeRevision: [1236, 1234], failure_map: FAILURE_MAP};
439
440     var resultsObject1 = createResultsObjectForTest(test, builderName1);
441     var resultsObject2 = createResultsObjectForTest(test, builderName2);
442
443     var result = collapsedRevisionList([resultsObject1, resultsObject2]).join(',');
444     var expected = [1236, 1235, 1235, 1234, 1232].join(',');
445     equal(result, expected, 'collapsedRevisionList result should be the unique chromium builds, sorted in descending order');
446 });
447
448 test('htmlForTestsWithMultipleRunsAtTheSameRevision', 1, function() {
449     resetGlobals();
450     builders.loadBuildersList('@ToT Blink', 'layout-tests');
451     var test = 'dummytest.html';
452
453     var builderName1 = 'WebKit Linux (dbg)';
454     // Note: r1235 results were generated thrice by three separate builds.
455     g_resultsByBuilder[builderName1] = {buildNumbers: [4, 3, 2, 1, 0], blinkRevision: [1235, 1235, 1235, 1234, 1233], failure_map: FAILURE_MAP};
456
457     var builderName2 = 'WebKit Win (dbg)';
458     g_resultsByBuilder[builderName2] = {buildNumbers: [6, 5], blinkRevision: [1236, 1234], failure_map: FAILURE_MAP};
459
460     var resultsObject1 = createResultsObjectForTest(test, builderName1);
461     resultsObject1.rawResults = [[0, 'F'], [1, 'I'], [2, 'I'], [3, 'P'], [4, 'F']];
462     resultsObject1.rawTimes = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]];
463     resultsObject1.bugs = ["crbug.com/1234", "crbug.com/5678", "crbug.com/9101112"];
464
465     var resultsObject2 = createResultsObjectForTest(test, builderName2);
466     resultsObject2.rawResults = [[4, 'F'], [5, 'I']];
467     resultsObject2.rawTimes = [[4, 0], [5, 5]];
468     resultsObject2.bugs = ["crbug.com/one", "crbug.com/two"];
469
470     g_testToResultsMap[test] = [resultsObject1, resultsObject2];
471     equal(htmlForIndividualTestOnAllBuildersWithResultsLinks(test),
472         '<table class=test-table><thead><tr>' +
473                 '<th sortValue=test><div class=table-header-content><span></span><span class=header-text>test</span></div></th>' +
474                 '<th sortValue=bugs><div class=table-header-content><span></span><span class=header-text>bugs</span></div></th>' +
475                 '<th sortValue=expectations><div class=table-header-content><span></span><span class=header-text>expectations</span></div></th>' +
476                 '<th sortValue=slowest><div class=table-header-content><span></span><span class=header-text>slowest run</span></div></th>' +
477                 '<th sortValue=flakiness colspan=10000><div class=table-header-content><span></span><span class=header-text>flakiness (numbers are runtimes in seconds)</span></div></th>' +
478             '</tr></thead>' +
479             '<tbody><tr>' +
480                 '<td class="test-link builder-name">WebKit Linux (dbg)' +
481                 '<td class=options-container>' +
482                     '<div><a href="http://crbug.com/1234">crbug.com/1234</a></div>' +
483                     '<div><a href="http://crbug.com/5678">crbug.com/5678</a></div>' +
484                     '<div><a href="http://crbug.com/9101112">crbug.com/9101112</a></div>' +
485                 '<td class=options-container><td>' +
486                     '<td title="Unknown result. Did not run tests." onclick=\'showPopupForInterpolatedResult(event, "1236")\' class="results interpolatedResult NODATA" >?</td>' +
487                     '<td title="TEXT. Click for more info." class="results TEXT" onclick=\'showPopupForBuild(event, "WebKit Linux (dbg)",0,"dummytest.html")\'></td>' +
488                     '<td title="IMAGE. Click for more info." class="results IMAGE" onclick=\'showPopupForBuild(event, "WebKit Linux (dbg)",1,"dummytest.html")\'></td>' +
489                     '<td title="IMAGE. Click for more info." class="results IMAGE" onclick=\'showPopupForBuild(event, "WebKit Linux (dbg)",2,"dummytest.html")\'></td>' +
490                     '<td title="PASS. Click for more info." class="results PASS" onclick=\'showPopupForBuild(event, "WebKit Linux (dbg)",3,"dummytest.html")\'></td>' +
491                     '<td title="PASS. Click for more info." class="results PASS" onclick=\'showPopupForBuild(event, "WebKit Linux (dbg)",4,"dummytest.html")\'></td>' +
492                 '<tr><td class="test-link builder-name">WebKit Win (dbg)' +
493                 '<td class=options-container>' +
494                     '<div><a href="http://crbug.com/one">crbug.com/one</a></div>' +
495                     '<div><a href="http://crbug.com/two">crbug.com/two</a></div>' +
496                 '<td class=options-container><td>' +
497                     '<td title="TEXT. Click for more info." class="results TEXT" onclick=\'showPopupForBuild(event, "WebKit Win (dbg)",0,"dummytest.html")\'></td>' +
498                     '<td title="Unknown result. Did not run tests." onclick=\'showPopupForInterpolatedResult(event, "1235")\' class="results interpolatedResult TEXT" >?</td>' +
499                     '<td title="Unknown result. Did not run tests." onclick=\'showPopupForInterpolatedResult(event, "1235")\' class="results interpolatedResult TEXT" >?</td>' +
500                     '<td title="Unknown result. Did not run tests." onclick=\'showPopupForInterpolatedResult(event, "1235")\' class="results interpolatedResult TEXT" >?</td>' +
501                     '<td title="TEXT. Click for more info." class="results TEXT" onclick=\'showPopupForBuild(event, "WebKit Win (dbg)",1,"dummytest.html")\'></td>' +
502                     '<td title="Unknown result. Did not run tests." onclick=\'showPopupForInterpolatedResult(event, "1233")\' class="results interpolatedResult NODATA" >?</td>' +
503             '</tbody>' +
504         '</table>' +
505         '<div>The following builders either don\'t run this test (e.g. it\'s skipped) or all recorded runs passed:</div>' +
506         '<div class=skipped-builder-list>' +
507             '<div class=skipped-builder>WebKit Linux</div><div class=skipped-builder>WebKit Mac10.7</div><div class=skipped-builder>WebKit Win</div>' +
508         '</div>' +
509         '<div class=expectations test=dummytest.html>' +
510             '<div><span class=link onclick="g_history.setQueryParameter(\'showExpectations\', true)">Show results</span> | ' +
511             '<span class=link onclick="g_history.setQueryParameter(\'showLargeExpectations\', true)">Show large thumbnails</span> | ' +
512             '<b>Only shows actual results/diffs from the most recent *failure* on each bot.</b></div>' +
513         '</div>');
514 });
515
516 test('collapsedRevisionListChromiumWithGitHash', 1, function() {
517     resetGlobals();
518     builders.loadBuildersList('@ToT Blink', 'layout-tests');
519     var test = 'dummytest.html';
520
521     var builderName = 'WebKit Linux (dbg)';
522     g_resultsByBuilder[builderName] = {buildNumbers: [0], blinkRevision: ['b7228ffd469f5d3f4a10952fb8e9a34acb2f0d4b'], failure_map: FAILURE_MAP};
523
524     var resultsObject = createResultsObjectForTest(test, builderName);
525     resultsObject.rawResults = [[0, 'P']];
526     resultsObject.rawTimes = [[0, 0]];
527     resultsObject.bugs = ["crbug.com/1234"];
528
529     g_testToResultsMap[test] = [resultsObject];
530     equal(htmlForIndividualTestOnAllBuildersWithResultsLinks(test),
531         '<table class=test-table>' +
532             '<thead><tr>' +
533                 '<th sortValue=test><div class=table-header-content><span></span><span class=header-text>test</span></div></th>' +
534                 '<th sortValue=bugs><div class=table-header-content><span></span><span class=header-text>bugs</span></div></th>' +
535                 '<th sortValue=expectations><div class=table-header-content><span></span><span class=header-text>expectations</span></div></th>' +
536                 '<th sortValue=slowest><div class=table-header-content><span></span><span class=header-text>slowest run</span></div></th>' +
537                 '<th sortValue=flakiness colspan=10000><div class=table-header-content><span></span><span class=header-text>flakiness (numbers are runtimes in seconds)</span></div></th>' +
538             '</tr></thead>' +
539             '<tbody><tr>' +
540                 '<td class="test-link builder-name">WebKit Linux (dbg)<td class=options-container><div><a href="http://crbug.com/1234">crbug.com/1234</a></div>' +
541                 '<td class=options-container><td><td title="Unknown result. Did not run tests." onclick=\'showPopupForInterpolatedResult(event, "b7228ffd469f5d3f4a10952fb8e9a34acb2f0d4b")\' class="results interpolatedResult NODATA" >?</td>' +
542             '</tbody>' +
543         '</table>' +
544         '<div>The following builders either don\'t run this test (e.g. it\'s skipped) or all recorded runs passed:</div>' +
545         '<div class=skipped-builder-list>' +
546             '<div class=skipped-builder>WebKit Linux</div>' +
547             '<div class=skipped-builder>WebKit Mac10.7</div>' +
548             '<div class=skipped-builder>WebKit Win</div>' +
549             '<div class=skipped-builder>WebKit Win (dbg)</div>' +
550         '</div>' +
551         '<div class=expectations test=dummytest.html>' +
552             '<div>' +
553                 '<span class=link onclick="g_history.setQueryParameter(\'showExpectations\', true)">Show results</span> | ' +
554                 '<span class=link onclick="g_history.setQueryParameter(\'showLargeExpectations\', true)">Show large thumbnails</span> | ' +
555                 '<b>Only shows actual results/diffs from the most recent *failure* on each bot.</b>' +
556             '</div>' +
557         '</div>');
558 });