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

Side by Side Diff: LayoutTests/dart/Multiscript.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/Encoding-expected.txt ('k') | LayoutTests/dart/Multiscript.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 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Dart test for testing isolation across multiple script tags.
6 #library("multiscript");
7 #import("dart:dom");
8 #import("dart:json");
9
10 class State {
11 static int s = 1;
12 static update() { s++; }
13 }
14
15 checkEventDelivery(id, expect) {
16 addHandler('test${id}', (m) {
17 State.update();
18 postResult(State.s, expect);
19 });
20 postMessage('test${id}', {});
21 }
22
23 onStart(handler) {
24 addHandler('start', handler);
25 }
26
27 addHandler(cmd, handler) {
28 window.addEventListener('message', (e) {
29 var msg = {};
30 // We do this, as unit test framework also uses DOM messages to function.
31 try {
32 msg = JSON.parse(e.data);
33 } catch (var e) {}
34 if (msg['multiscript-cmd'] == cmd) {
35 handler(msg);
36 }
37 }, false);
38 }
39
40 postMessage(cmd, params) {
41 params['multiscript-cmd'] = cmd;
42 window.postMessage(JSON.stringify(params), '*');
43 }
44
45 postResult(actual, expect) {
46 postMessage('done', {'actual': actual, 'expect': expect});
47 }
OLDNEW
« no previous file with comments | « LayoutTests/dart/Encoding-expected.txt ('k') | LayoutTests/dart/Multiscript.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698