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

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: Include error name Created 6 years, 8 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 description, debug, successfullyParsed; 9 var description, debug, successfullyParsed;
10 10
11 var expectingError; // set by shouldHaveError() 11 var expectingError; // set by expectError()
12 var expectedErrorMessage; // set by onerror when expectingError is true 12 var expectedErrorMessage; // set by onerror when expectingError is true
13 var unexpectedErrorMessage; // set by onerror when expectingError is not true 13 var unexpectedErrorMessage; // set by onerror when expectingError is not true
14 14
15 (function() { 15 (function() {
16 16
17 function getOrCreate(id, tagName) 17 function getOrCreate(id, tagName)
18 { 18 {
19 var element = document.getElementById(id); 19 var element = document.getElementById(id);
20 if (element) 20 if (element)
21 return element; 21 return element;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 window.addEventListener('DOMContentLoaded', handleTestFinished, false); 94 window.addEventListener('DOMContentLoaded', handleTestFinished, false);
95 insertStyleSheet(); 95 insertStyleSheet();
96 } 96 }
97 97
98 if (!self.isOnErrorTest) { 98 if (!self.isOnErrorTest) {
99 self.onerror = function(message) 99 self.onerror = function(message)
100 { 100 {
101 if (self.expectingError) { 101 if (self.expectingError) {
102 self.expectedErrorMessage = message; 102 self.expectedErrorMessage = message;
103 self.expectingError = false; 103 self.expectingError = false;
104 return; 104 // Consume expected error in worker, so window doesn't fail the test.
105 return isWorker();
105 } 106 }
106 self.unexpectedErrorMessage = message; 107 self.unexpectedErrorMessage = message;
107 if (self.jsTestIsAsync) { 108 if (self.jsTestIsAsync) {
108 self.testFailed("Unexpected error: " + message); 109 self.testFailed("Unexpected error: " + message);
109 finishJSTest(); 110 finishJSTest();
110 } 111 }
111 }; 112 };
112 } 113 }
113 })(); 114 })();
114 115
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 625
625 testPassed(a + " is equivalent to Date.now()."); 626 testPassed(a + " is equivalent to Date.now().");
626 return; 627 return;
627 } 628 }
628 testFailed(a + " cannot be tested against the current time. The clock is goi ng backwards too often."); 629 testFailed(a + " cannot be tested against the current time. The clock is goi ng backwards too often.");
629 } 630 }
630 631
631 function expectError() 632 function expectError()
632 { 633 {
633 if (expectingError) { 634 if (expectingError) {
634 testFailed("shouldHaveError() called twice before an error occurred!"); 635 testFailed("expectError() called twice before an error occurred!");
635 } 636 }
636 expectingError = true; 637 expectingError = true;
637 } 638 }
638 639
639 function shouldHaveHadError(message) 640 function shouldHaveHadError(message)
640 { 641 {
641 if (expectingError) { 642 if (expectingError) {
642 testFailed("No error thrown between expectError() and shouldHaveHadError ()"); 643 testFailed("No error thrown between expectError() and shouldHaveHadError ()");
643 return; 644 return;
644 } 645 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 testPassed = function(msg) { 786 testPassed = function(msg) {
786 workerPort.postMessage('PASS:' + msg); 787 workerPort.postMessage('PASS:' + msg);
787 }; 788 };
788 finishJSTest = function() { 789 finishJSTest = function() {
789 workerPort.postMessage('DONE:'); 790 workerPort.postMessage('DONE:');
790 }; 791 };
791 debug = function(msg) { 792 debug = function(msg) {
792 workerPort.postMessage(msg); 793 workerPort.postMessage(msg);
793 }; 794 };
794 } 795 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698