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

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

Issue 243523003: Fire window.onerror for uncaught IndexedDB errors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove FIXMEs Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex t + pixel results 1 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex t + pixel results
2 if (self.testRunner) { 2 if (self.testRunner) {
3 if (self.enablePixelTesting) 3 if (self.enablePixelTesting)
4 testRunner.dumpAsTextWithPixelResults(); 4 testRunner.dumpAsTextWithPixelResults();
5 else 5 else
6 testRunner.dumpAsText(); 6 testRunner.dumpAsText();
7 } 7 }
8 8
9 var isJsTest = true; 9 var isJsTest = true;
10 10
11 var description, debug, successfullyParsed; 11 var description, debug, successfullyParsed;
12 12
13 var expectingError; // set by shouldHaveError() 13 var expectingError; // set by expectError()
14 var expectedErrorMessage; // set by onerror when expectingError is true 14 var expectedErrorMessage; // set by onerror when expectingError is true
15 var unexpectedErrorMessage; // set by onerror when expectingError is not true 15 var unexpectedErrorMessage; // set by onerror when expectingError is not true
16 16
17 (function() { 17 (function() {
18 18
19 function getOrCreate(id, tagName) 19 function getOrCreate(id, tagName)
20 { 20 {
21 var element = document.getElementById(id); 21 var element = document.getElementById(id);
22 if (element) 22 if (element)
23 return element; 23 return element;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 window.addEventListener('DOMContentLoaded', handleTestFinished, false); 96 window.addEventListener('DOMContentLoaded', handleTestFinished, false);
97 insertStyleSheet(); 97 insertStyleSheet();
98 } 98 }
99 99
100 if (!self.isOnErrorTest) { 100 if (!self.isOnErrorTest) {
101 self.onerror = function(message) 101 self.onerror = function(message)
102 { 102 {
103 if (self.expectingError) { 103 if (self.expectingError) {
104 self.expectedErrorMessage = message; 104 self.expectedErrorMessage = message;
105 self.expectingError = false; 105 self.expectingError = false;
106 return; 106 // Consume expected error in worker, so window doesn't fail the test.
107 return isWorker();
107 } 108 }
108 self.unexpectedErrorMessage = message; 109 self.unexpectedErrorMessage = message;
109 if (self.jsTestIsAsync) { 110 if (self.jsTestIsAsync) {
110 self.testFailed("Unexpected error: " + message); 111 self.testFailed("Unexpected error: " + message);
111 finishJSTest(); 112 finishJSTest();
112 } 113 }
113 }; 114 };
114 } 115 }
115 })(); 116 })();
116 117
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 651
651 testPassed(a + " is equivalent to Date.now()."); 652 testPassed(a + " is equivalent to Date.now().");
652 return; 653 return;
653 } 654 }
654 testFailed(a + " cannot be tested against the current time. The clock is goi ng backwards too often."); 655 testFailed(a + " cannot be tested against the current time. The clock is goi ng backwards too often.");
655 } 656 }
656 657
657 function expectError() 658 function expectError()
658 { 659 {
659 if (expectingError) { 660 if (expectingError) {
660 testFailed("shouldHaveError() called twice before an error occurred!"); 661 testFailed("expectError() called twice before an error occurred!");
661 } 662 }
662 expectingError = true; 663 expectingError = true;
663 } 664 }
664 665
665 function shouldHaveHadError(message) 666 function shouldHaveHadError(message)
666 { 667 {
667 if (expectingError) { 668 if (expectingError) {
668 testFailed("No error thrown between expectError() and shouldHaveHadError ()"); 669 testFailed("No error thrown between expectError() and shouldHaveHadError ()");
669 return; 670 return;
670 } 671 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 testPassed = function(msg) { 812 testPassed = function(msg) {
812 workerPort.postMessage('PASS:' + msg); 813 workerPort.postMessage('PASS:' + msg);
813 }; 814 };
814 finishJSTest = function() { 815 finishJSTest = function() {
815 workerPort.postMessage('DONE:'); 816 workerPort.postMessage('DONE:');
816 }; 817 };
817 debug = function(msg) { 818 debug = function(msg) {
818 workerPort.postMessage(msg); 819 workerPort.postMessage(msg);
819 }; 820 };
820 } 821 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698