| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 function getArguments() { | 5 function getArguments() { |
| 6 // Returns the URL arguments as a dictionary. | 6 // Returns the URL arguments as a dictionary. |
| 7 args = {} | 7 args = {} |
| 8 var s = location.search; | 8 var s = location.search; |
| 9 if (s) { | 9 if (s) { |
| 10 var vals = s.substring(1).split('&'); | 10 var vals = s.substring(1).split('&'); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 .startsWith(suite_name); | 39 .startsWith(suite_name); |
| 40 if (!table_block_in_suite) { | 40 if (!table_block_in_suite) { |
| 41 testTableBlock.style.display = 'none'; | 41 testTableBlock.style.display = 'none'; |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 testTableBlock.style.display = 'table-row-group'; | 45 testTableBlock.style.display = 'table-row-group'; |
| 46 }); | 46 }); |
| 47 showTestTable(true); | 47 showTestTable(true); |
| 48 showSuiteTable(false); | 48 showSuiteTable(false); |
| 49 window.scrollTo(0, 0); |
| 50 } |
| 51 |
| 52 function showTestsOfOneSuiteOnlyWithNewState(suite_name) { |
| 53 showTestsOfOneSuiteOnly(suite_name); |
| 54 history.pushState({suite: suite_name}, suite_name, ''); |
| 49 } | 55 } |
| 50 | 56 |
| 51 function showSuiteTableOnly() { | 57 function showSuiteTableOnly() { |
| 52 setTitle('Suites Summary') | 58 setTitle('Suites Summary') |
| 53 showTestTable(false); | 59 showTestTable(false); |
| 54 showSuiteTable(true); | 60 showSuiteTable(true); |
| 61 window.scrollTo(0, 0); |
| 62 } |
| 63 |
| 64 function showSuiteTableOnlyWithReplaceState() { |
| 65 showSuiteTableOnly(); |
| 66 history.replaceState({}, 'suite_table', ''); |
| 67 } |
| 68 |
| 69 function setBrowserBackButtonLogic() { |
| 70 window.onpopstate = function(event) { |
| 71 if (!event.state || !event.state.suite) { |
| 72 showSuiteTableOnly(); |
| 73 } else { |
| 74 showTestsOfOneSuiteOnly(event.state.suite); |
| 75 } |
| 76 }; |
| 55 } | 77 } |
| 56 | 78 |
| 57 function setTitle(title) { | 79 function setTitle(title) { |
| 58 document.getElementById('summary-header').textContent = title; | 80 document.getElementById('summary-header').textContent = title; |
| 59 } | 81 } |
| 60 | 82 |
| 61 function sortByColumn(head) { | 83 function sortByColumn(head) { |
| 62 var table = head.parentNode.parentNode.parentNode; | 84 var table = head.parentNode.parentNode.parentNode; |
| 63 var rowBlocks = Array.prototype.slice.call( | 85 var rowBlocks = Array.prototype.slice.call( |
| 64 table.getElementsByTagName('tbody')); | 86 table.getElementsByTagName('tbody')); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 (b_rows.length - b_success_or_skipped) / btotal_minus_skipped); | 181 (b_rows.length - b_success_or_skipped) / btotal_minus_skipped); |
| 160 } | 182 } |
| 161 return asc * (avalue - bvalue); | 183 return asc * (avalue - bvalue); |
| 162 }); | 184 }); |
| 163 | 185 |
| 164 for (var i = 0; i < rowBlocks.length; i++) { | 186 for (var i = 0; i < rowBlocks.length; i++) { |
| 165 table.appendChild(rowBlocks[i]); | 187 table.appendChild(rowBlocks[i]); |
| 166 } | 188 } |
| 167 } | 189 } |
| 168 | 190 |
| 169 function loadPage() { | |
| 170 var args = getArguments(); | |
| 171 if ('suite' in args) { | |
| 172 // The user wants to visit detailed 'subpage' of that suite. | |
| 173 showTestsOfOneSuiteOnly(args['suite']); | |
| 174 } else { | |
| 175 // The user wants to visit the summary of all suites. | |
| 176 showSuiteTableOnly(); | |
| 177 } | |
| 178 } | |
| 179 | |
| 180 function reportIssues() { | 191 function reportIssues() { |
| 181 var url = 'https://bugs.chromium.org/p/chromium/issues/entry?' + | 192 var url = 'https://bugs.chromium.org/p/chromium/issues/entry?' + |
| 182 'labels=Pri-2,Type-Bug,Restrict-View-Google&' + | 193 'labels=Pri-2,Type-Bug,Restrict-View-Google&' + |
| 183 'summary=Result Details Feedback:&' + | 194 'summary=Result Details Feedback:&' + |
| 184 'comment=Please check out: ' + window.location; | 195 'comment=Please check out: ' + window.location; |
| 185 var newWindow = window.open(url, '_blank'); | 196 var newWindow = window.open(url, '_blank'); |
| 186 newWindow.focus(); | 197 newWindow.focus(); |
| 187 } | 198 } |
| OLD | NEW |