| 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, ''); | |
| 55 } | 49 } |
| 56 | 50 |
| 57 function showSuiteTableOnly() { | 51 function showSuiteTableOnly() { |
| 58 setTitle('Suites Summary') | 52 setTitle('Suites Summary') |
| 59 showTestTable(false); | 53 showTestTable(false); |
| 60 showSuiteTable(true); | 54 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 }; | |
| 77 } | 55 } |
| 78 | 56 |
| 79 function setTitle(title) { | 57 function setTitle(title) { |
| 80 document.getElementById('summary-header').textContent = title; | 58 document.getElementById('summary-header').textContent = title; |
| 81 } | 59 } |
| 82 | 60 |
| 83 function sortByColumn(head) { | 61 function sortByColumn(head) { |
| 84 var table = head.parentNode.parentNode.parentNode; | 62 var table = head.parentNode.parentNode.parentNode; |
| 85 var rowBlocks = Array.prototype.slice.call( | 63 var rowBlocks = Array.prototype.slice.call( |
| 86 table.getElementsByTagName('tbody')); | 64 table.getElementsByTagName('tbody')); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 (b_rows.length - b_success_or_skipped) / btotal_minus_skipped); | 159 (b_rows.length - b_success_or_skipped) / btotal_minus_skipped); |
| 182 } | 160 } |
| 183 return asc * (avalue - bvalue); | 161 return asc * (avalue - bvalue); |
| 184 }); | 162 }); |
| 185 | 163 |
| 186 for (var i = 0; i < rowBlocks.length; i++) { | 164 for (var i = 0; i < rowBlocks.length; i++) { |
| 187 table.appendChild(rowBlocks[i]); | 165 table.appendChild(rowBlocks[i]); |
| 188 } | 166 } |
| 189 } | 167 } |
| 190 | 168 |
| 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 |
| 191 function reportIssues() { | 180 function reportIssues() { |
| 192 var url = 'https://bugs.chromium.org/p/chromium/issues/entry?' + | 181 var url = 'https://bugs.chromium.org/p/chromium/issues/entry?' + |
| 193 'labels=Pri-2,Type-Bug,Restrict-View-Google&' + | 182 'labels=Pri-2,Type-Bug,Restrict-View-Google&' + |
| 194 'summary=Result Details Feedback:&' + | 183 'summary=Result Details Feedback:&' + |
| 195 'comment=Please check out: ' + window.location; | 184 'comment=Please check out: ' + window.location; |
| 196 var newWindow = window.open(url, '_blank'); | 185 var newWindow = window.open(url, '_blank'); |
| 197 newWindow.focus(); | 186 newWindow.focus(); |
| 198 } | 187 } |
| OLD | NEW |