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

Side by Side Diff: LayoutTests/fast/events/constructors/message-event-constructor.html

Issue 23319002: Set MessageEvent.source to the newly created port for shared workers' connect events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add test and assertions Created 7 years, 4 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
« no previous file with comments | « no previous file | LayoutTests/fast/events/constructors/message-event-constructor-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../js/resources/js-test-pre.js"></script> 4 <script src="../../js/resources/js-test-pre.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 8
9 description("This tests the constructor for the MessageEvent DOM class."); 9 description("This tests the constructor for the MessageEvent DOM class.");
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 shouldBeEqualToString("new MessageEvent('eventType', { " + attr + ": {valueO f: function () { return 'melancholy'; } } })." + attr, "[object Object]"); 64 shouldBeEqualToString("new MessageEvent('eventType', { " + attr + ": {valueO f: function () { return 'melancholy'; } } })." + attr, "[object Object]");
65 shouldBeEqualToString("new MessageEvent('eventType', { get " + attr + "() { return 123; } })." + attr, "123"); 65 shouldBeEqualToString("new MessageEvent('eventType', { get " + attr + "() { return 123; } })." + attr, "123");
66 shouldThrow("new MessageEvent('eventType', { get " + attr + "() { throw 'Mes sageEvent Error'; } })"); 66 shouldThrow("new MessageEvent('eventType', { get " + attr + "() { throw 'Mes sageEvent Error'; } })");
67 }); 67 });
68 68
69 // source is passed. 69 // source is passed.
70 // Window objects. 70 // Window objects.
71 shouldBe("new MessageEvent('eventType', { source: window }).source", "window"); 71 shouldBe("new MessageEvent('eventType', { source: window }).source", "window");
72 shouldBe("new MessageEvent('eventType', { source: this }).source", "this"); 72 shouldBe("new MessageEvent('eventType', { source: this }).source", "this");
73 73
74 // MessagePort objects.
75 var channel = new MessageChannel();
76 shouldBe("new MessageEvent('eventType', { ports: [channel.port1], source: channe l.port1 }).source", "null");
do-not-use 2013/08/19 20:47:55 I added this check as well since I assume this is
77
74 // Non-window objects. 78 // Non-window objects.
75 shouldBe("new MessageEvent('eventType', { source: test_object }).source", "null" ); 79 shouldBe("new MessageEvent('eventType', { source: test_object }).source", "null" );
76 shouldBe("new MessageEvent('eventType', { source: document }).source", "null"); 80 shouldBe("new MessageEvent('eventType', { source: document }).source", "null");
81 shouldBe("new MessageEvent('eventType', { source: document.body }).source", "nul l");
do-not-use 2013/08/19 20:47:55 Added a Node check as suggested.
77 shouldBe("new MessageEvent('eventType', { source: undefined }).source", "null"); 82 shouldBe("new MessageEvent('eventType', { source: undefined }).source", "null");
78 shouldBe("new MessageEvent('eventType', { source: null }).source", "null"); 83 shouldBe("new MessageEvent('eventType', { source: null }).source", "null");
79 shouldBe("new MessageEvent('eventType', { source: false }).source", "null"); 84 shouldBe("new MessageEvent('eventType', { source: false }).source", "null");
80 shouldBe("new MessageEvent('eventType', { source: true }).source", "null"); 85 shouldBe("new MessageEvent('eventType', { source: true }).source", "null");
81 shouldBe("new MessageEvent('eventType', { source: '' }).source", "null"); 86 shouldBe("new MessageEvent('eventType', { source: '' }).source", "null");
82 shouldBe("new MessageEvent('eventType', { source: 'chocolate' }).source", "null" ); 87 shouldBe("new MessageEvent('eventType', { source: 'chocolate' }).source", "null" );
83 shouldBe("new MessageEvent('eventType', { source: 12345 }).source", "null"); 88 shouldBe("new MessageEvent('eventType', { source: 12345 }).source", "null");
84 shouldBe("new MessageEvent('eventType', { source: 18446744073709551615 }).source ", "null"); 89 shouldBe("new MessageEvent('eventType', { source: 18446744073709551615 }).source ", "null");
85 shouldBe("new MessageEvent('eventType', { source: NaN }).source", "null"); 90 shouldBe("new MessageEvent('eventType', { source: NaN }).source", "null");
86 // Note that valueOf() is not called, when the left hand side is evaluated. 91 // Note that valueOf() is not called, when the left hand side is evaluated.
87 shouldBeFalse("new MessageEvent('eventType', { source: {valueOf: function () { r eturn window; } } }).source == window"); 92 shouldBeFalse("new MessageEvent('eventType', { source: {valueOf: function () { r eturn window; } } }).source == window");
88 shouldBe("new MessageEvent('eventType', { get source() { return 123; } }).source ", "null"); 93 shouldBe("new MessageEvent('eventType', { get source() { return 123; } }).source ", "null");
89 shouldThrow("new MessageEvent('eventType', { get source() { throw 'MessageEvent Error'; } })"); 94 shouldThrow("new MessageEvent('eventType', { get source() { throw 'MessageEvent Error'; } })");
90 95
91 // ports is passed. 96 // ports is passed.
92 // Valid message ports. 97 // Valid message ports.
93 var channel = new MessageChannel();
94 var channel2 = new MessageChannel(); 98 var channel2 = new MessageChannel();
95 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2, channel2.port1] }).ports[0]", "channel.port1"); 99 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2, channel2.port1] }).ports[0]", "channel.port1");
96 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2, channel2.port1] }).ports[1]", "channel.port2"); 100 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2, channel2.port1] }).ports[1]", "channel.port2");
97 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2, channel2.port1] }).ports[2]", "channel2.port1"); 101 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2, channel2.port1] }).ports[2]", "channel2.port1");
98 shouldBe("new MessageEvent('eventType', { ports: [] }).ports", "[]"); 102 shouldBe("new MessageEvent('eventType', { ports: [] }).ports", "[]");
99 shouldBe("new MessageEvent('eventType', { ports: undefined }).ports", "[]"); 103 shouldBe("new MessageEvent('eventType', { ports: undefined }).ports", "[]");
100 shouldBe("new MessageEvent('eventType', { ports: null }).ports", "[]"); 104 shouldBe("new MessageEvent('eventType', { ports: null }).ports", "[]");
101 105
102 // Invalid message ports. 106 // Invalid message ports.
103 shouldThrow("new MessageEvent('eventType', { ports: [1, 2, 3] }).ports[2]"); 107 shouldThrow("new MessageEvent('eventType', { ports: [1, 2, 3] }).ports[2]");
(...skipping 18 matching lines...) Expand all
122 shouldBeEqualToString("new MessageEvent('eventType', { bubbles: true, cancelable : true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source : window, ports: [channel.port1, channel.port2, channel2.port1] }).origin", "won derful"); 126 shouldBeEqualToString("new MessageEvent('eventType', { bubbles: true, cancelable : true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source : window, ports: [channel.port1, channel.port2, channel2.port1] }).origin", "won derful");
123 shouldBeEqualToString("new MessageEvent('eventType', { bubbles: true, cancelable : true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source : window, ports: [channel.port1, channel.port2, channel2.port1] }).lastEventId", "excellent"); 127 shouldBeEqualToString("new MessageEvent('eventType', { bubbles: true, cancelable : true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source : window, ports: [channel.port1, channel.port2, channel2.port1] }).lastEventId", "excellent");
124 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por ts: [channel.port1, channel.port2, channel2.port1] }).source", "window"); 128 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por ts: [channel.port1, channel.port2, channel2.port1] }).source", "window");
125 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por ts: [channel.port1, channel.port2, channel2.port1] }).ports[0]", "channel.port1" ); 129 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por ts: [channel.port1, channel.port2, channel2.port1] }).ports[0]", "channel.port1" );
126 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por ts: [channel.port1, channel.port2, channel2.port1] }).ports[1]", "channel.port2" ); 130 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por ts: [channel.port1, channel.port2, channel2.port1] }).ports[1]", "channel.port2" );
127 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por ts: [channel.port1, channel.port2, channel2.port1] }).ports[2]", "channel2.port1 "); 131 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por ts: [channel.port1, channel.port2, channel2.port1] }).ports[2]", "channel2.port1 ");
128 </script> 132 </script>
129 <script src="../../js/resources/js-test-post.js"></script> 133 <script src="../../js/resources/js-test-post.js"></script>
130 </body> 134 </body>
131 </html> 135 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/constructors/message-event-constructor-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698