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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/workers/semantics/reporting-errors/001.html

Issue 2418853003: Worker: Import "imported/wpt/workers" tests (Retry) (Closed)
Patch Set: rebase Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/workers/semantics/reporting-errors/001.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/workers/semantics/reporting-errors/001.html b/third_party/WebKit/LayoutTests/imported/wpt/workers/semantics/reporting-errors/001.html
new file mode 100644
index 0000000000000000000000000000000000000000..adba81f6353e6ff1db650eb2e8d81e08d073fc2c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/workers/semantics/reporting-errors/001.html
@@ -0,0 +1,53 @@
+<!--
+var port;
+var timeout;
+onerror = function(a,b,c,d,e) {
+ // will return undefined, thus the error is "not handled"
+ // so error should be reported to the user, but this test doesn't check
+ // that.
+ // just make sure that this method is invoked with five arguments
+ clearTimeout(timeout);
+ var log = '';
+ if (arguments.length != 5)
+ log += 'got ' + arguments.length + ' arguments, expected 5. ';
+ if (typeof a != 'string')
+ log += 'first argument wasn\'t a string. ';
+ if (b != location.href)
+ log += 'second argument was ' + b + ', expected ' + location.href + '. ';
+ if (typeof c != 'number')
+ log += 'third argument wasn\'t a number. ';
+ if (typeof d != 'number')
+ log += 'fourth argument wasn\'t a number. ';
+ if (e != 42)
+ log += 'fifth argument wasn\'t the thrown exception. ';
+ port.postMessage(log);
+}
+onconnect = function (e) {
+ port = e.ports[0];
+ timeout = setTimeout(function() { port.postMessage('self.onerror was not invoked'); }, 250);
+ throw 42; // will "report the error"
+}
+
+
+/*
+-->
+<!doctype html>
+<title>shared worker, not handled</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+setup({allow_uncaught_exception:true});
+async_test(function() {
+ window.onerror = this.step_func(function(a) {
+ assert_unreached('window.onerror invoked: ' + a);
+ });
+ var worker = new SharedWorker('#', '');
+ worker.port.onmessage = this.step_func_done(function(e) {
+ assert_equals(e.data, '');
+ });
+});
+</script>
+<!--
+*/
+//-->

Powered by Google App Engine
This is Rietveld 408576698