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

Side by Side Diff: tests/dom/dom_isolates_test.dart

Issue 10178014: Copy lib/dom tests that use dart:html to lib/html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 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
« no previous file with comments | « tests/dom/dom_constructors_test.dart ('k') | tests/dom/domparser_test.dart » ('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 #library('DOMIsolatesTest');
2 #import('../../lib/unittest/unittest.dart');
3 #import('../../lib/unittest/html_config.dart');
4 #import('dart:html');
5 #import('dart:isolate');
6
7 isolateMain(port) {
8 port.receive((msg, replyTo) {
9 if (msg != 'check') {
10 replyTo.send('wrong msg: $msg');
11 }
12 replyTo.send(window.location.toString());
13 port.close();
14 });
15 }
16
17 isolateMainTrampoline(port) {
18 final childPortFuture = spawnDomIsolate(window, 'isolateMain');
19 port.receive((msg, parentPort) {
20 childPortFuture.then((childPort) {
21 childPort.call(msg).then((response) {
22 parentPort.send(response);
23 port.close();
24 });
25 });
26 });
27 }
28
29 main() {
30 useHtmlConfiguration();
31
32 final iframe = new Element.tag('iframe');
33 document.body.nodes.add(iframe);
34
35 asyncTest('Simple DOM isolate test', 1, () {
36 spawnDomIsolate(iframe.contentWindow, 'isolateMain').then((sendPort) {
37 sendPort.call('check').then((msg) {
38 Expect.equals('about:blank', msg);
39 callbackDone();
40 });
41 });
42 });
43
44 asyncTest('Nested DOM isolates test', 1, () {
45 spawnDomIsolate(iframe.contentWindow, 'isolateMainTrampoline').then((sendPor t) {
46 sendPort.call('check').then((msg) {
47 Expect.equals('about:blank', msg);
48 callbackDone();
49 });
50 });
51 });
52
53 test('Null as target window', () {
54 expectThrow(() => spawnDomIsolate(null, 'isolateMain'));
55 });
56
57 test('Not window as target window', () {
58 expectThrow(() => spawnDomIsolate(document, 'isolateMain'));
59 });
60 }
OLDNEW
« no previous file with comments | « tests/dom/dom_constructors_test.dart ('k') | tests/dom/domparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698