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

Side by Side Diff: LayoutTests/fast/harness/resources/archived-results-dashboard-test.js

Issue 339623002: Added support for versioning of layout test results of run-webkit-tests runs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added layout test Created 6 years, 4 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
OLDNEW
(Empty)
1 if (window.testRunner)
2 testRunner.dumpAsText();
3
4 var testStyles = document.createElement('style');
5 testStyles.innerText = ".test-pass { color: green; } .test-fail { color: red; }" ;
6 document.querySelector('head').appendChild(testStyles);
7
8 var g_testIndex = 0;
9 var g_log = ["You should see a series of PASS lines."];
10 function mockResults()
11 {
12 return {
13 result_links: [],
14 tests: {}
15 };
16 }
17 function mockArchivedResults(results_set)
18 {
19 return {
20 archived_results : results_set
21 }
22 }
23 function logPass(msg)
24 {
25 g_log.push('TEST-' + g_testIndex + ': <span class="test-pass">' + msg + '</s pan>')
26 }
27
28 function logFail(msg)
29 {
30 g_log.push('TEST-' + g_testIndex + ': <span class="test-fail">' + msg + '</s pan>')
31 }
32
33 function assertTrue(bool)
34 {
35 if (bool)
36 logPass('PASS');
37 else
38 logFail('FAIL');
39 }
40 function runTest(results, assertions, opt_localStorageValue)
41 {
42 document.body.innerHTML = '';
43 g_testIndex++;
44 g_state = undefined;
45 try {
46 ADD_RESULTS(results);
47 originalGeneratePage();
48 } catch (e) {
49 logFail("FAIL: uncaught exception " + e.toString());
50 }
51
52 try {
53 assertions();
54 } catch (e) {
55 logFail("FAIL: uncaught exception executing assertions " + e.toString()) ;
56 }
57 }
58 function runTests()
59 {
60 var results = mockResults();
61 results.result_links.push('dir1/results.html');
62 results.result_links.push('dir2/results.html');
63 results.result_links.push('dir3/results.html');
64 results.tests['foo-1.html'] = mockArchivedResults(['PASS', 'FAIL', 'SKIP']);
65 results.tests['foo-2.html'] = mockArchivedResults(['FAIL', 'PASS', 'PASS']);
66 var subtree = results.tests["virtual"] = {};
67 subtree["foo-3.html"] = mockArchivedResults(['SKIP', 'PASS', 'SKIP']);
68
69 var result = '';
70 runTest(results, function() {
71 var table = document.getElementById('results-table');
72 assertTrue(table.rows.length == 4);
73 assertTrue(table.rows[0].cells.length == 4);
74 assertTrue(table.rows[1].cells[0].innerHTML == 'foo-1.html');
75 assertTrue(table.rows[3].cells[0].innerHTML == 'virtual/foo-3.html');
76 assertTrue(table.rows[1].cells[1].className == 'test-pass');
77 assertTrue(table.rows[1].cells[2].className == 'test-fail');
78 assertTrue(table.rows[1].cells[3].className == 'test-skip');
79 var row = table.rows[1];
80 var dummyhref = document.createElement("a");
81 dummyhref.href = 'dir1/results.html';
82 assertTrue(row.cells[1].getElementsByTagName('a')[0] == dummyhref.href);
83 dummyhref.href = 'dir2/results.html';
84 assertTrue(row.cells[2].getElementsByTagName('a')[0] == dummyhref.href);
85 dummyhref.href = 'dir3/results.html';
86 assertTrue(row.cells[3].getElementsByTagName('a')[0] == dummyhref.href);
87 });
88 document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>';
89 }
90
91 var originalGeneratePage = generatePage;
92 generatePage = runTests;
OLDNEW
« no previous file with comments | « LayoutTests/fast/harness/archived-results-dashboard-expected.txt ('k') | LayoutTests/fast/harness/results.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698