Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(849)

Side by Side Diff: third_party/WebKit/LayoutTests/resources/js-test.js

Issue 1772853002: Block the HTML parser on external stylesheets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified parser blocking logic Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // js-test now supports lazily printing test results which dumps all test 1 // js-test now supports lazily printing test results which dumps all test
2 // results once at the end of the test instead of building them up. To enable 2 // results once at the end of the test instead of building them up. To enable
3 // this option, call setPrintTestResultsLazily() before running any tests. 3 // this option, call setPrintTestResultsLazily() before running any tests.
4 var _lazyTestResults; // Set by setPrintTestResultsLazily(). 4 var _lazyTestResults; // Set by setPrintTestResultsLazily().
5 var _lazyDescription; // Set by description() after setPrintTestResultsLazily(). 5 var _lazyDescription; // Set by description() after setPrintTestResultsLazily().
6 6
7 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex t + pixel results 7 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex t + pixel results
8 if (self.testRunner) { 8 if (self.testRunner) {
9 if (self.enablePixelTesting) 9 if (self.enablePixelTesting)
10 testRunner.dumpAsTextWithPixelResults(); 10 testRunner.dumpAsTextWithPixelResults();
(...skipping 26 matching lines...) Expand all
37 else 37 else
38 refNode = parent.firstChild; 38 refNode = parent.firstChild;
39 39
40 parent.insertBefore(element, refNode); 40 parent.insertBefore(element, refNode);
41 return element; 41 return element;
42 } 42 }
43 43
44 description = function description(msg, quiet) 44 description = function description(msg, quiet)
45 { 45 {
46 // For MSIE 6 compatibility 46 // For MSIE 6 compatibility
47 var span = document.createElement("span"); 47 var mgsHTML = '';
48 if (quiet) 48 if (quiet)
49 span.innerHTML = '<p>' + msg + '</p><p>On success, you will see no " <span class="fail">FAIL</span>" messages, followed by "<span class="pass">TEST C OMPLETE</span>".</p>'; 49 mgsHTML = '<p>' + msg + '</p><p>On success, you will see no "<span c lass="fail">FAIL</span>" messages, followed by "<span class="pass">TEST COMPLETE </span>".</p>';
50 else 50 else
51 span.innerHTML = '<p>' + msg + '</p><p>On success, you will see a se ries of "<span class="pass">PASS</span>" messages, followed by "<span class="pas s">TEST COMPLETE</span>".</p>'; 51 mgsHTML = '<p>' + msg + '</p><p>On success, you will see a series of "<span class="pass">PASS</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>';
52 52
53 if (_lazyTestResults) { 53 if (self._lazyTestResults) {
54 _lazyDescription = span; 54 self._lazyDescription = mgsHTML;
55 return; 55 return;
56 } 56 }
57 57
58 var span = document.createElement("span");
59 span.innerHTML = mgsHTML;
58 var description = getOrCreateTestElement("description", "p"); 60 var description = getOrCreateTestElement("description", "p");
59 if (description.firstChild) 61 if (description.firstChild)
60 description.replaceChild(span, description.firstChild); 62 description.replaceChild(span, description.firstChild);
61 else 63 else
62 description.appendChild(span); 64 description.appendChild(span);
63 }; 65 };
64 66
65 debug = function debug(msg) 67 debug = function debug(msg)
66 { 68 {
67 if (self._lazyTestResults) { 69 if (self._lazyTestResults) {
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 813
812 // It's possible for an async test to call finishJSTest() before js-test-post.js 814 // It's possible for an async test to call finishJSTest() before js-test-post.js
813 // has been parsed. 815 // has been parsed.
814 function finishJSTest() 816 function finishJSTest()
815 { 817 {
816 wasFinishJSTestCalled = true; 818 wasFinishJSTestCalled = true;
817 if (!self.wasPostTestScriptParsed) 819 if (!self.wasPostTestScriptParsed)
818 return; 820 return;
819 isSuccessfullyParsed(); 821 isSuccessfullyParsed();
820 822
821 if (self._lazyDescription) 823 if (self._lazyDescription) {
822 getOrCreateTestElement("description", "p").appendChild(self._lazyDescripti on); 824 var descriptionElement = getOrCreateTestElement("description", "p");
825 var span = document.createElement("span");
826 descriptionElement.appendChild(span);
827 span.innerHTML = self._lazyDescription;
828 self._lazyDescription = undefined;
829 }
823 830
824 if (self._lazyTestResults && self._lazyTestResults.length > 0) { 831 if (self._lazyTestResults && self._lazyTestResults.length > 0) {
825 var consoleElement = getOrCreateTestElement("console", "div"); 832 var consoleElement = getOrCreateTestElement("console", "div");
826 self._lazyTestResults.forEach(function(msg) { 833 self._lazyTestResults.forEach(function(msg) {
827 var span = document.createElement("span"); 834 var span = document.createElement("span");
828 consoleElement.appendChild(span); 835 consoleElement.appendChild(span);
829 span.innerHTML = msg + '<br />'; 836 span.innerHTML = msg + '<br />';
830 }); 837 });
838 self._lazyTestResults = [];
831 } 839 }
832 840
833 if (self.jsTestIsAsync && self.testRunner) 841 if (self.jsTestIsAsync && self.testRunner)
834 testRunner.notifyDone(); 842 testRunner.notifyDone();
835 } 843 }
836 844
837 function startWorker(testScriptURL, workerType) 845 function startWorker(testScriptURL, workerType)
838 { 846 {
839 self.jsTestIsAsync = true; 847 self.jsTestIsAsync = true;
840 debug('Starting worker: ' + testScriptURL); 848 debug('Starting worker: ' + testScriptURL);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 testPassed = function(msg) { 921 testPassed = function(msg) {
914 workerPort.postMessage('PASS:' + msg); 922 workerPort.postMessage('PASS:' + msg);
915 }; 923 };
916 finishJSTest = function() { 924 finishJSTest = function() {
917 workerPort.postMessage('DONE:'); 925 workerPort.postMessage('DONE:');
918 }; 926 };
919 debug = function(msg) { 927 debug = function(msg) {
920 workerPort.postMessage(msg); 928 workerPort.postMessage(msg);
921 }; 929 };
922 } 930 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698