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 testTablePage(suite_name, push_state) { | |
jbudorick
2017/04/11 18:43:02
My motivation w/ this suggestion was to eliminate
| |
53 showTestsOfOneSuiteOnly(suite_name); | |
54 if (push_state) { | |
55 history.pushState({suite: suite_name}, suite_name, ''); | |
56 } | |
49 } | 57 } |
50 | 58 |
51 function showSuiteTableOnly() { | 59 function showSuiteTableOnly() { |
52 setTitle('Suites Summary') | 60 setTitle('Suites Summary') |
53 showTestTable(false); | 61 showTestTable(false); |
54 showSuiteTable(true); | 62 showSuiteTable(true); |
63 window.scrollTo(0, 0); | |
64 } | |
65 | |
66 function suiteTablePage(replace_state) { | |
67 showSuiteTableOnly(); | |
68 if (replace_state) { | |
69 history.replaceState({}, 'suite_table', ''); | |
70 } | |
71 } | |
72 | |
73 function setBrowserBackButtonLogic() { | |
74 window.onpopstate = function(event) { | |
75 if (!event.state || !event.state.suite) { | |
76 suiteTablePage(false); | |
77 } else { | |
78 testTablePage(event.state.suite, false); | |
79 } | |
80 }; | |
55 } | 81 } |
56 | 82 |
57 function setTitle(title) { | 83 function setTitle(title) { |
58 document.getElementById('summary-header').textContent = title; | 84 document.getElementById('summary-header').textContent = title; |
59 } | 85 } |
60 | 86 |
61 function sortByColumn(head) { | 87 function sortByColumn(head) { |
62 var table = head.parentNode.parentNode.parentNode; | 88 var table = head.parentNode.parentNode.parentNode; |
63 var rowBlocks = Array.prototype.slice.call( | 89 var rowBlocks = Array.prototype.slice.call( |
64 table.getElementsByTagName('tbody')); | 90 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); | 185 (b_rows.length - b_success_or_skipped) / btotal_minus_skipped); |
160 } | 186 } |
161 return asc * (avalue - bvalue); | 187 return asc * (avalue - bvalue); |
162 }); | 188 }); |
163 | 189 |
164 for (var i = 0; i < rowBlocks.length; i++) { | 190 for (var i = 0; i < rowBlocks.length; i++) { |
165 table.appendChild(rowBlocks[i]); | 191 table.appendChild(rowBlocks[i]); |
166 } | 192 } |
167 } | 193 } |
168 | 194 |
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() { | 195 function reportIssues() { |
181 var url = 'https://bugs.chromium.org/p/chromium/issues/entry?' + | 196 var url = 'https://bugs.chromium.org/p/chromium/issues/entry?' + |
182 'labels=Pri-2,Type-Bug,Restrict-View-Google&' + | 197 'labels=Pri-2,Type-Bug,Restrict-View-Google&' + |
183 'summary=Result Details Feedback:&' + | 198 'summary=Result Details Feedback:&' + |
184 'comment=Please check out: ' + window.location; | 199 'comment=Please check out: ' + window.location; |
185 var newWindow = window.open(url, '_blank'); | 200 var newWindow = window.open(url, '_blank'); |
186 newWindow.focus(); | 201 newWindow.focus(); |
187 } | 202 } |
OLD | NEW |