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

Side by Side Diff: tests/html/js_interop_element_test.dart

Issue 10914129: Remove proxying support from dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Regen dart:html Created 8 years, 3 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/html/html.status ('k') | tests/html/js_interop_func_passing_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 // Copyright (c) 2012, 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 #library('JsInteropElementTest');
6 #import('../../pkg/unittest/unittest.dart');
7 #import('../../pkg/unittest/html_config.dart');
8 #import('dart:html');
9 #import('dart:isolate');
10
11 injectSource(code) {
12 final script = new ScriptElement();
13 script.type = 'text/javascript';
14 script.innerHTML = code;
15 document.body.nodes.add(script);
16 }
17
18 var jsElementTest = """
19 var canvas = document.createElement('canvas');
20 document.body.appendChild(canvas);
21
22 var port = window.lookupPort('test1');
23 port.callSync(canvas);
24 """;
25
26 var dartElementTest = """
27 var port = new ReceivePortSync();
28 port.receive(function (data) {
29 return (data instanceof HTMLDivElement);
30 });
31 window.registerPort('test2', port.toSendPort());
32 """;
33
34 main() {
35 useHtmlConfiguration();
36
37 test('js-element', () {
38 int invoked = 0;
39
40 var port = new ReceivePortSync();
41 port.receive((data) {
42 expect(data is CanvasElement);
43 ++invoked;
44 });
45 window.registerPort('test1', port.toSendPort());
46
47 injectSource(jsElementTest);
48 expect(invoked, equals(1));
49 });
50
51 test('dart-element', () {
52 injectSource(dartElementTest);
53
54 var port = window.lookupPort('test2');
55 var div = new DivElement();
56 var canvas = new CanvasElement(100,100);
57 document.body.nodes.addAll([div, canvas]);
58 expect(port.callSync(div));
59 expect(!port.callSync(canvas));
60 });
61 }
OLDNEW
« no previous file with comments | « tests/html/html.status ('k') | tests/html/js_interop_func_passing_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698