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

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

Issue 10873037: Support methods, getters, and setters on JS proxies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix status 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') | no next file » | 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('JsInteropObjInvokeTest');
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 jsProxyTest = """
19 function TestType(x) {
20 this.x = x;
21 }
22 TestType.prototype.razzle = function () {
23 return this.x * 2;
24 }
25 var data = new TestType(21);
26
27 var port = window.lookupPort('test1');
28 port.callSync(data);
29 """;
30
31 main() {
32 useHtmlConfiguration();
33
34 test('js-proxy', () {
35 int invoked = 0;
36
37 var port = new ReceivePortSync();
38 port.receive((data) {
39 expect(data.x, equals(21));
40 expect(data.razzle(), equals(42));
41 data.x = 100;
42 expect(data.razzle(), equals(200));
43
44 ++invoked;
45 });
46 window.registerPort('test1', port.toSendPort());
47
48 injectSource(jsProxyTest);
49 expect(invoked, equals(1));
50 });
51 }
OLDNEW
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698