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

Side by Side Diff: LayoutTests/dart/dom/Isolates.dart

Issue 9188009: Things to unfork. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 8 years, 11 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 | « LayoutTests/dart/dom/IsolateLight-expected.txt ('k') | LayoutTests/dart/dom/Isolates.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #import('../../../../../dart/client/testing/unittest/unittest.dart');
2 #import('dart:dom');
3 #import('dart:json');
4
5 class PingPongIsolate extends Isolate {
6 PingPongIsolate() : super.heavy();
7
8 void main() {
9 bool wasThrown = false;
10 try {
11 window.alert('Test');
12 } catch(final e) {
13 wasThrown = true;
14 }
15 // If wasn't thrown, do not listen to messages to make test fail.
16 if (!wasThrown) {
17 return;
18 }
19
20 // Check that JSON library was loaded to isolate.
21 JSON.stringify([1, 2, 3]);
22
23 port.receive((message, replyTo) {
24 replyTo.send(responseFor(message), null);
25 });
26 }
27
28 static String responseFor(message) => 'response for $message';
29 }
30
31 main() {
32 forLayoutTests();
33 asyncTest('IsolateSpawn', 1, () {
34 new PingPongIsolate().spawn().then((SendPort port) {
35 callbackDone();
36 });
37 });
38 asyncTest('NonDOMIsolates', 1, () {
39 new PingPongIsolate().spawn().then((SendPort port) {
40 final msg1 = 'foo';
41 final msg2 = 'bar';
42 port.call(msg1).receive((response, _) {
43 Expect.equals(PingPongIsolate.responseFor(msg1), response);
44 port.call(msg2).receive((response, _) {
45 Expect.equals(PingPongIsolate.responseFor(msg2), response);
46 callbackDone();
47 });
48 });
49 });
50 });
51 }
OLDNEW
« no previous file with comments | « LayoutTests/dart/dom/IsolateLight-expected.txt ('k') | LayoutTests/dart/dom/Isolates.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698