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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 set testLinks(testLinks) { | 228 set testLinks(testLinks) { |
229 this.testLinks_ = testLinks; | 229 this.testLinks_ = testLinks; |
230 var linksEl = this.querySelector('#links'); | 230 var linksEl = this.querySelector('#links'); |
231 linksEl.textContent = ''; | 231 linksEl.textContent = ''; |
232 this.testLinks_.forEach(function(l) { | 232 this.testLinks_.forEach(function(l) { |
233 var link = document.createElement('a'); | 233 var link = document.createElement('a'); |
234 link.href = l.linkPath; | 234 link.href = l.linkPath; |
235 link.textContent = l.title; | 235 link.textContent = l.title; |
236 | 236 |
237 var li = document.createElement('li'); | 237 var li = document.createElement('li'); |
238 li.appendChild(link); | 238 Polymer.dom(li).appendChild(link); |
239 | 239 |
240 linksEl.appendChild(li); | 240 Polymer.dom(linksEl).appendChild(li); |
241 }, this); | 241 }, this); |
242 }, | 242 }, |
243 | 243 |
244 get testFilterString() { | 244 get testFilterString() { |
245 return this.testFilterString_; | 245 return this.testFilterString_; |
246 }, | 246 }, |
247 | 247 |
248 set testFilterString(testFilterString) { | 248 set testFilterString(testFilterString) { |
249 this.testFilterString_ = testFilterString; | 249 this.testFilterString_ = testFilterString; |
250 this.scheduleRerun_(); | 250 this.scheduleRerun_(); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 span.classList.add('fail'); |
346 span.appendChild(document.createTextNode('F')); | 346 Polymer.dom(span).appendChild(document.createTextNode('F')); |
347 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 span.classList.add('flaky'); |
353 span.appendChild(document.createTextNode('~')); | 353 Polymer.dom(span).appendChild(document.createTextNode('~')); |
354 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 statsEl.innerHTML = |
364 '<span>' + numTestsThatRan + '/' + numTestsOverall + | 364 '<span>' + numTestsThatRan + '/' + numTestsOverall + |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_); |
410 this.results_.addEventListener('testflaky', this.onTestFlaky_); | 410 this.results_.addEventListener('testflaky', this.onTestFlaky_); |
411 this.results_.addEventListener('statschange', | 411 this.results_.addEventListener('statschange', |
412 this.onResultsStatsChanged_); | 412 this.onResultsStatsChanged_); |
413 resultsContainer.appendChild(this.results_); | 413 Polymer.dom(resultsContainer).appendChild(this.results_); |
414 | 414 |
415 var tests = this.allTests_.filter(function(test) { | 415 var tests = this.allTests_.filter(function(test) { |
416 var i = test.fullyQualifiedName.indexOf(this.testFilterString_); | 416 var i = test.fullyQualifiedName.indexOf(this.testFilterString_); |
417 if (i == -1) | 417 if (i == -1) |
418 return false; | 418 return false; |
419 if (this.testTypeToRun_ !== ALL_TEST_TYPES && | 419 if (this.testTypeToRun_ !== ALL_TEST_TYPES && |
420 test.testType !== this.testTypeToRun_) | 420 test.testType !== this.testTypeToRun_) |
421 return false; | 421 return false; |
422 return true; | 422 return true; |
423 }, this); | 423 }, this); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 overlay.style.left = 0; | 598 overlay.style.left = 0; |
599 overlay.style.padding = '8px'; | 599 overlay.style.padding = '8px'; |
600 overlay.style.position = 'fixed'; | 600 overlay.style.position = 'fixed'; |
601 overlay.style.top = 0; | 601 overlay.style.top = 0; |
602 overlay.style.flexDirection = 'column'; | 602 overlay.style.flexDirection = 'column'; |
603 overlay.style.width = '100%'; | 603 overlay.style.width = '100%'; |
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 overlay.appendChild(element); | 608 Polymer.dom(overlay).appendChild(element); |
609 | 609 |
610 element.textContent = 'Loading tests...'; | 610 element.textContent = 'Loading tests...'; |
611 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 = document.body.querySelector('#tests-loading-overlay'); |
615 document.body.removeChild(overlay); | 615 document.body.removeChild(overlay); |
616 } | 616 } |
617 | 617 |
618 function updateTitle(state) { | 618 function updateTitle(state) { |
619 var testFilterString = state.testFilterString || ''; | 619 var testFilterString = state.testFilterString || ''; |
620 var testSuiteName = state.testSuiteName || ''; | 620 var testSuiteName = state.testSuiteName || ''; |
621 | 621 |
(...skipping 15 matching lines...) Expand all Loading... |
637 if (runner) | 637 if (runner) |
638 runner.title = title; | 638 runner.title = title; |
639 } | 639 } |
640 | 640 |
641 function runTests(loader, state) { | 641 function runTests(loader, state) { |
642 var runner = new tr.b.unittest.InteractiveTestRunner(); | 642 var runner = new tr.b.unittest.InteractiveTestRunner(); |
643 runner.style.width = '100%'; | 643 runner.style.width = '100%'; |
644 runner.style.height = '100%'; | 644 runner.style.height = '100%'; |
645 runner.testLinks = runnerConfig.testLinks; | 645 runner.testLinks = runnerConfig.testLinks; |
646 runner.allTests = loader.getAllTests(); | 646 runner.allTests = loader.getAllTests(); |
647 document.body.appendChild(runner); | 647 Polymer.dom(document.body).appendChild(runner); |
648 | 648 |
649 runner.setState(state); | 649 runner.setState(state); |
650 updateTitle(state); | 650 updateTitle(state); |
651 | 651 |
652 runner.addEventListener('statechange', function() { | 652 runner.addEventListener('statechange', function() { |
653 var state = runner.getState(); | 653 var state = runner.getState(); |
654 var stateString = stateToSearchString(runner.getDefaultState(), | 654 var stateString = stateToSearchString(runner.getDefaultState(), |
655 state); | 655 state); |
656 if (window.location.search.substring(1) == stateString) | 656 if (window.location.search.substring(1) == stateString) |
657 return; | 657 return; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 | 692 |
693 loadAndRunTestsImpl(); | 693 loadAndRunTestsImpl(); |
694 } | 694 } |
695 | 695 |
696 return { | 696 return { |
697 InteractiveTestRunner: InteractiveTestRunner, | 697 InteractiveTestRunner: InteractiveTestRunner, |
698 loadAndRunTests: loadAndRunTests | 698 loadAndRunTests: loadAndRunTests |
699 }; | 699 }; |
700 }); | 700 }); |
701 </script> | 701 </script> |
OLD | NEW |