OLD | NEW |
1 if (window.testRunner) | 1 if (window.testRunner) |
2 testRunner.dumpAsText(); | 2 testRunner.dumpAsText(); |
3 | 3 |
4 var testStyles = document.createElement('style'); | 4 var testStyles = document.createElement('style'); |
5 testStyles.innerText = ".test-pass { color: green; } .test-fail { color: red; }"
; | 5 testStyles.innerText = ".test-pass { color: green; } .test-fail { color: red; }"
; |
6 document.querySelector('head').appendChild(testStyles); | 6 document.querySelector('head').appendChild(testStyles); |
7 | 7 |
8 var g_testIndex = 0; | 8 var g_testIndex = 0; |
9 var g_log = ["You should see a series of PASS lines."]; | 9 var g_log = ["You should see a series of PASS lines."]; |
10 function mockResults() | 10 function mockResults() |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 results.result_links.push('dir2/results.html'); | 62 results.result_links.push('dir2/results.html'); |
63 results.result_links.push('dir3/results.html'); | 63 results.result_links.push('dir3/results.html'); |
64 results.tests['foo-1.html'] = mockArchivedResults(['PASS', 'FAIL', 'SKIP']); | 64 results.tests['foo-1.html'] = mockArchivedResults(['PASS', 'FAIL', 'SKIP']); |
65 results.tests['foo-2.html'] = mockArchivedResults(['FAIL', 'PASS', 'PASS']); | 65 results.tests['foo-2.html'] = mockArchivedResults(['FAIL', 'PASS', 'PASS']); |
66 var subtree = results.tests["virtual"] = {}; | 66 var subtree = results.tests["virtual"] = {}; |
67 subtree["foo-3.html"] = mockArchivedResults(['SKIP', 'PASS', 'SKIP']); | 67 subtree["foo-3.html"] = mockArchivedResults(['SKIP', 'PASS', 'SKIP']); |
68 | 68 |
69 var result = ''; | 69 var result = ''; |
70 runTest(results, function() { | 70 runTest(results, function() { |
71 var table = document.getElementById('results-table'); | 71 var table = document.getElementById('results-table'); |
72 assertTrue(table.rows.length == 4); | 72 assertTrue(table.rows.length == 5); |
73 assertTrue(table.rows[0].cells.length == 5); | 73 assertTrue(table.rows[2].cells.length == 5); |
74 assertTrue(table.rows[1].cells[1].innerHTML == 'foo-1.html'); | 74 assertTrue(table.rows[2].cells[1].innerHTML == 'foo-1.html'); |
75 assertTrue(table.rows[3].cells[1].innerHTML == 'virtual/foo-3.html'); | 75 assertTrue(table.rows[4].cells[1].innerHTML == 'virtual/foo-3.html'); |
76 assertTrue(table.rows[1].cells[2].className == 'test-pass'); | 76 assertTrue(table.rows[2].cells[2].className == 'test-pass'); |
77 assertTrue(table.rows[1].cells[3].className == 'test-fail'); | 77 assertTrue(table.rows[2].cells[3].className == 'test-fail'); |
78 assertTrue(table.rows[1].cells[4].className == 'test-skip'); | 78 assertTrue(table.rows[2].cells[4].className == 'test-skip'); |
79 var row = table.rows[1]; | 79 var row = table.rows[2]; |
80 var dummyhref = document.createElement("a"); | 80 var dummyhref = document.createElement("a"); |
81 dummyhref.href = 'dir1/results.html'; | 81 dummyhref.href = 'dir1/results.html'; |
82 assertTrue(row.cells[2].getElementsByTagName('a')[0] == dummyhref.href); | 82 assertTrue(row.cells[2].getElementsByTagName('a')[0] == dummyhref.href); |
83 dummyhref.href = 'dir2/results.html'; | 83 dummyhref.href = 'dir2/results.html'; |
84 assertTrue(row.cells[3].getElementsByTagName('a')[0] == dummyhref.href); | 84 assertTrue(row.cells[3].getElementsByTagName('a')[0] == dummyhref.href); |
85 dummyhref.href = 'dir3/results.html'; | 85 dummyhref.href = 'dir3/results.html'; |
86 assertTrue(row.cells[4].getElementsByTagName('a')[0] == dummyhref.href); | 86 assertTrue(row.cells[4].getElementsByTagName('a')[0] == dummyhref.href); |
87 }); | 87 }); |
88 document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>'; | 88 document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>'; |
89 } | 89 } |
90 | 90 |
91 var originalGeneratePage = generatePage; | 91 var originalGeneratePage = generatePage; |
92 generatePage = runTests; | 92 generatePage = runTests; |
OLD | NEW |