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

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

Issue 2984403002: dart2js_native tests: Migrate 'native STRING' to JS-calls (Closed)
Patch Set: the rest of the files Created 3 years, 4 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
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 "native_testing.dart"; 5 import "native_testing.dart";
6 6
7 @Native("NNative") 7 @Native("NNative")
8 class NNative { 8 class NNative {
9 var status; 9 var status;
10 10
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 27
28 wrap(cb) { 28 wrap(cb) {
29 return (val) { 29 return (val) {
30 return cb("!!! $val !!!"); 30 return cb("!!! $val !!!");
31 }; 31 };
32 } 32 }
33 33
34 nativeId(x) native; 34 nativeId(x) native;
35 35
36 void setup() native """ 36 void setup() {
37 JS('', r"""
38 (function(){
37 nativeId = function(x) { return x; } 39 nativeId = function(x) { return x; }
38 """; 40 })()""");
41 }
39 42
40 main() { 43 main() {
41 setup(); 44 setup();
42 // Make sure the ClickCounter class goes through interceptors. 45 // Make sure the ClickCounter class goes through interceptors.
43 Expect.equals("### !!! 42 !!! ###", nativeId(new ClickCounter()).f(42)); 46 Expect.equals("### !!! 42 !!! ###", nativeId(new ClickCounter()).f(42));
44 // We are interested in the direct call, where the type is known. 47 // We are interested in the direct call, where the type is known.
45 Expect.equals("### !!! 499 !!! ###", new ClickCounter().f(499)); 48 Expect.equals("### !!! 499 !!! ###", new ClickCounter().f(499));
46 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698