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

Side by Side Diff: tests/compiler/dart2js_native/native_field_invocation3_test.dart

Issue 383413003: Add @Native(...) annotation for native class names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 5 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "dart:_js_helper";
5 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
6 7
7 makeCC() native; 8 makeCC() native;
8 9
9 void setup() native """ 10 void setup() native """
10 function CC() {} 11 function CC() {}
11 makeCC = function() { return new CC; } 12 makeCC = function() { return new CC; }
12 """; 13 """;
13 14
14 15
15 class ClickCounter native "CC" { 16 @Native("CC")
17 class ClickCounter {
16 var status; 18 var status;
17 19
18 var foo; 20 var foo;
19 21
20 init() { 22 init() {
21 foo = wrap(g); 23 foo = wrap(g);
22 } 24 }
23 25
24 g(val) => "### $val ###"; 26 g(val) => "### $val ###";
25 } 27 }
26 28
27 wrap(cb) { 29 wrap(cb) {
28 return (val) { 30 return (val) {
29 return cb("!!! $val !!!"); 31 return cb("!!! $val !!!");
30 }; 32 };
31 } 33 }
32 34
33 main() { 35 main() {
34 setup(); 36 setup();
35 var c = makeCC(); 37 var c = makeCC();
36 c.init(); 38 c.init();
37 // `foo` contains a closure. Make sure that invoking foo through an 39 // `foo` contains a closure. Make sure that invoking foo through an
38 // interceptor works. 40 // interceptor works.
39 Expect.equals("### !!! 499 !!! ###", c.foo(499)); 41 Expect.equals("### !!! 499 !!! ###", c.foo(499));
40 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698