OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/base/base.html"> | 8 <link rel="import" href="/tracing/base/base.html"> |
9 <link rel="import" href="/tracing/base/unittest.html"> | 9 <link rel="import" href="/tracing/base/unittest.html"> |
10 <link rel="import" href="/tracing/base/unittest/html_test_results.html"> | 10 <link rel="import" href="/tracing/base/unittest/html_test_results.html"> |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 tr.b.dispatchSimpleEvent(this, 'statechange'); | 335 tr.b.dispatchSimpleEvent(this, 'statechange'); |
336 }, | 336 }, |
337 | 337 |
338 onTestPassed_: function() { | 338 onTestPassed_: function() { |
339 this.querySelector('#shortform-results'). | 339 this.querySelector('#shortform-results'). |
340 appendChild(document.createTextNode('.')); | 340 appendChild(document.createTextNode('.')); |
341 }, | 341 }, |
342 | 342 |
343 onTestFailed_: function() { | 343 onTestFailed_: function() { |
344 var span = document.createElement('span'); | 344 var span = document.createElement('span'); |
345 span.classList.add('fail'); | 345 Polymer.dom(span).classList.add('fail'); |
346 Polymer.dom(span).appendChild(document.createTextNode('F')); | 346 Polymer.dom(span).appendChild(document.createTextNode('F')); |
347 Polymer.dom(this.querySelector('#shortform-results')).appendChild(span); | 347 Polymer.dom(this.querySelector('#shortform-results')).appendChild(span); |
348 }, | 348 }, |
349 | 349 |
350 onTestFlaky_: function() { | 350 onTestFlaky_: function() { |
351 var span = document.createElement('span'); | 351 var span = document.createElement('span'); |
352 span.classList.add('flaky'); | 352 Polymer.dom(span).classList.add('flaky'); |
353 Polymer.dom(span).appendChild(document.createTextNode('~')); | 353 Polymer.dom(span).appendChild(document.createTextNode('~')); |
354 Polymer.dom(this.querySelector('#shortform-results')).appendChild(span); | 354 Polymer.dom(this.querySelector('#shortform-results')).appendChild(span); |
355 }, | 355 }, |
356 | 356 |
357 onResultsStatsChanged_: function() { | 357 onResultsStatsChanged_: function() { |
358 var statsEl = this.querySelector('#stats'); | 358 var statsEl = this.querySelector('#stats'); |
359 var stats = this.results_.getStats(); | 359 var stats = this.results_.getStats(); |
360 var numTestsOverall = this.runner_.testCases.length; | 360 var numTestsOverall = this.runner_.testCases.length; |
361 var numTestsThatRan = stats.numTestsThatPassed + | 361 var numTestsThatRan = stats.numTestsThatPassed + |
362 stats.numTestsThatFailed + stats.numFlakyTests; | 362 stats.numTestsThatFailed + stats.numFlakyTests; |
363 statsEl.innerHTML = | 363 Polymer.dom(statsEl).innerHTML = |
364 '<span>' + numTestsThatRan + '/' + numTestsOverall + | 364 '<span>' + numTestsThatRan + '/' + numTestsOverall + |
365 '</span> tests run, ' + | 365 '</span> tests run, ' + |
366 '<span class="unittest-failed">' + stats.numTestsThatFailed + | 366 '<span class="unittest-failed">' + stats.numTestsThatFailed + |
367 '</span> failures, ' + | 367 '</span> failures, ' + |
368 '<span class="unittest-flaky">' + stats.numFlakyTests + | 368 '<span class="unittest-flaky">' + stats.numFlakyTests + |
369 '</span> flaky, ' + | 369 '</span> flaky, ' + |
370 ' in ' + stats.totalRunTime.toFixed(2) + 'ms.'; | 370 ' in ' + stats.totalRunTime.toFixed(2) + 'ms.'; |
371 }, | 371 }, |
372 | 372 |
373 scheduleRerun_: function() { | 373 scheduleRerun_: function() { |
(...skipping 15 matching lines...) Expand all Loading... |
389 | 389 |
390 beginRunning_: function() { | 390 beginRunning_: function() { |
391 var resultsContainer = this.querySelector('#results-container'); | 391 var resultsContainer = this.querySelector('#results-container'); |
392 if (this.results_) { | 392 if (this.results_) { |
393 this.results_.removeEventListener('testpassed', this.onTestPassed_); | 393 this.results_.removeEventListener('testpassed', this.onTestPassed_); |
394 this.results_.removeEventListener('testfailed', this.onTestFailed_); | 394 this.results_.removeEventListener('testfailed', this.onTestFailed_); |
395 this.results_.removeEventListener('testflaky', this.onTestFlaky_); | 395 this.results_.removeEventListener('testflaky', this.onTestFlaky_); |
396 this.results_.removeEventListener('statschange', | 396 this.results_.removeEventListener('statschange', |
397 this.onResultsStatsChanged_); | 397 this.onResultsStatsChanged_); |
398 delete this.results_.getHRefForTestCase; | 398 delete this.results_.getHRefForTestCase; |
399 resultsContainer.removeChild(this.results_); | 399 Polymer.dom(resultsContainer).removeChild(this.results_); |
400 } | 400 } |
401 | 401 |
402 this.results_ = new tr.b.unittest.HTMLTestResults(); | 402 this.results_ = new tr.b.unittest.HTMLTestResults(); |
403 this.results_.headless = this.headless_; | 403 this.results_.headless = this.headless_; |
404 this.results_.getHRefForTestCase = this.getHRefForTestCase.bind(this); | 404 this.results_.getHRefForTestCase = this.getHRefForTestCase.bind(this); |
405 this.updateResultsGivenShortFormat_(); | 405 this.updateResultsGivenShortFormat_(); |
406 | 406 |
407 this.results_.shortFormat = this.shortFormat_; | 407 this.results_.shortFormat = this.shortFormat_; |
408 this.results_.addEventListener('testpassed', this.onTestPassed_); | 408 this.results_.addEventListener('testpassed', this.onTestPassed_); |
409 this.results_.addEventListener('testfailed', this.onTestFailed_); | 409 this.results_.addEventListener('testfailed', this.onTestFailed_); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 | 604 |
605 var element = document.createElement('div'); | 605 var element = document.createElement('div'); |
606 element.style.flex = '1 1 auto'; | 606 element.style.flex = '1 1 auto'; |
607 element.style.overflow = 'auto'; | 607 element.style.overflow = 'auto'; |
608 Polymer.dom(overlay).appendChild(element); | 608 Polymer.dom(overlay).appendChild(element); |
609 | 609 |
610 element.textContent = 'Loading tests...'; | 610 element.textContent = 'Loading tests...'; |
611 Polymer.dom(document.body).appendChild(overlay); | 611 Polymer.dom(document.body).appendChild(overlay); |
612 } | 612 } |
613 function hideLoadingOverlay() { | 613 function hideLoadingOverlay() { |
614 var overlay = document.body.querySelector('#tests-loading-overlay'); | 614 var overlay = Polymer.dom(document.body).querySelector( |
615 document.body.removeChild(overlay); | 615 '#tests-loading-overlay'); |
| 616 Polymer.dom(document.body).removeChild(overlay); |
616 } | 617 } |
617 | 618 |
618 function updateTitle(state) { | 619 function updateTitle(state) { |
619 var testFilterString = state.testFilterString || ''; | 620 var testFilterString = state.testFilterString || ''; |
620 var testSuiteName = state.testSuiteName || ''; | 621 var testSuiteName = state.testSuiteName || ''; |
621 | 622 |
622 var title; | 623 var title; |
623 if (testSuiteName && testFilterString.length) { | 624 if (testSuiteName && testFilterString.length) { |
624 title = testFilterString + ' in ' + testSuiteName; | 625 title = testFilterString + ' in ' + testSuiteName; |
625 } else if (testSuiteName) { | 626 } else if (testSuiteName) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 | 693 |
693 loadAndRunTestsImpl(); | 694 loadAndRunTestsImpl(); |
694 } | 695 } |
695 | 696 |
696 return { | 697 return { |
697 InteractiveTestRunner: InteractiveTestRunner, | 698 InteractiveTestRunner: InteractiveTestRunner, |
698 loadAndRunTests: loadAndRunTests | 699 loadAndRunTests: loadAndRunTests |
699 }; | 700 }; |
700 }); | 701 }); |
701 </script> | 702 </script> |
OLD | NEW |