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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/workers/interfaces/DedicatedWorkerGlobalScope/onmessage.worker.js

Issue 2420483004: Revert of Worker: Import "imported/wpt/workers" tests (Closed)
Patch Set: Fix merge error 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 unified diff | Download patch
OLDNEW
(Empty)
1 importScripts("/resources/testharness.js");
2
3 test(function() {
4 self.onmessage = 1;
5 assert_equals(self.onmessage, null,
6 "attribute should return null after being set to a primitive");
7 }, "Setting onmessage to 1");
8
9 test(function() {
10 var object = {
11 handleEvent: this.unreached_func()
12 };
13 self.onmessage = object;
14 assert_equals(self.onmessage, object,
15 "attribute should return the object it was set to.");
16
17 self.dispatchEvent(new Event("message"));
18 }, "Setting onmessage to an object");
19
20 test(function() {
21 var triggered = false;
22 var f = function(e) { triggered = true; };
23 self.onmessage = f;
24 assert_equals(self.onmessage, f,
25 "attribute should return the function it was set to.");
26
27 self.dispatchEvent(new Event("message"));
28 assert_true(triggered, "event handler should have been triggered");
29 }, "Setting onmessage to a function");
30
31
32 test(function() {
33 assert_not_equals(self.onmessage, null,
34 "attribute should not return null after being set to a funct ion");
35 self.onmessage = 1;
36 assert_equals(self.onmessage, null,
37 "attribute should return null after being set to a primitive");
38 }, "Setting onmessage to 1 (again)");
39
40 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698