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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: Created 4 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
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 "dart:_js_helper";
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 @Native("NNative") 8 @Native("NNative")
9 class NNative { 9 class NNative {
10 var status; 10 var status;
11 11
12 var f; 12 var f;
13 13
14 ClickCounter() { 14 ClickCounter() {
15 f = wrap(g); 15 f = wrap(g);
16 } 16 }
17 17
18 g(val) => "### $val ###"; 18 g(val) => "### $val ###";
19 } 19 }
20 20
21 nativeId(x) native; 21 nativeId(x) native ;
22 22
23 void setup() native """ 23 void setup() native """
24 nativeId = function(x) { return x; } 24 nativeId = function(x) { return x; }
25 """; 25 """;
26 26
27
28 class ClickCounter { 27 class ClickCounter {
29 var status; 28 var status;
30 29
31 var f; 30 var f;
32 31
33 ClickCounter() { 32 ClickCounter() {
34 f = wrap(g); 33 f = wrap(g);
35 } 34 }
36 35
37 g(val) => "### $val ###"; 36 g(val) => "### $val ###";
38 } 37 }
39 38
40 wrap(cb) { 39 wrap(cb) {
41 return (val) { 40 return (val) {
42 return cb("!!! $val !!!"); 41 return cb("!!! $val !!!");
43 }; 42 };
44 } 43 }
45 44
46 main() { 45 main() {
47 setup(); 46 setup();
48 // Make sure the ClickCounter class goes through interceptors. 47 // Make sure the ClickCounter class goes through interceptors.
49 Expect.equals("### !!! 42 !!! ###", nativeId(new ClickCounter()).f(42)); 48 Expect.equals("### !!! 42 !!! ###", nativeId(new ClickCounter()).f(42));
50 // We are interested in the direct call, where the type is known. 49 // We are interested in the direct call, where the type is known.
51 Expect.equals("### !!! 499 !!! ###", new ClickCounter().f(499)); 50 Expect.equals("### !!! 499 !!! ###", new ClickCounter().f(499));
52 } 51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698