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

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

Issue 2383273002: Revert "Add native_testing library to mock @Native classes" (Closed)
Patch Set: Created 4 years, 2 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "dart:_js_helper";
6 import "package:expect/expect.dart";
6 7
7 // Test calling convention of property extraction closures. 8 // Test calling convention of property extraction closures.
8 9
9 class AA { 10 class AA {
10 bar(a, [b = 'A']) => 'AA.bar($a, $b)'; // bar is plain dart convention. 11 bar(a, [b = 'A']) => 'AA.bar($a, $b)'; // bar is plain dart convention.
11 foo(a, [b = 'A']) => 'AA.foo($a, $b)'; // foo has interceptor convention. 12 foo(a, [b = 'A']) => 'AA.foo($a, $b)'; // foo has interceptor convention.
12 } 13 }
13 14
14 @Native("BB") 15 @Native("BB")
15 class BB { 16 class BB {
(...skipping 18 matching lines...) Expand all
34 }; 35 };
35 36
36 function CC() {} 37 function CC() {}
37 CC.prototype.foo = function(u, v) { 38 CC.prototype.foo = function(u, v) {
38 return 'CC.foo(' + u + ', ' + v + ')'; 39 return 'CC.foo(' + u + ', ' + v + ')';
39 }; 40 };
40 41
41 makeBB = function(){return new BB;}; 42 makeBB = function(){return new BB;};
42 makeCC = function(){return new CC;}; 43 makeCC = function(){return new CC;};
43 inscrutable = function(a){return a;}; 44 inscrutable = function(a){return a;};
44
45 self.nativeConstructor(BB);
46 self.nativeConstructor(CC);
47 """; 45 """;
48 46
49 main() { 47 main() {
50 nativeTesting();
51 setup(); 48 setup();
52 var a = inscrutable(new AA()); 49 var a = inscrutable(new AA());
53 var b = inscrutable(makeBB()); 50 var b = inscrutable(makeBB());
54 var c = inscrutable(makeCC)(); 51 var c = inscrutable(makeCC)();
55 52
56 Expect.equals('AA.bar(1, A)', inscrutable(a).bar(1)); 53 Expect.equals('AA.bar(1, A)', inscrutable(a).bar(1));
57 Expect.equals('AA.bar(2, 3)', inscrutable(a).bar(2, 3)); 54 Expect.equals('AA.bar(2, 3)', inscrutable(a).bar(2, 3));
58 55
59 Expect.equals('AA.foo(1, A)', inscrutable(a).foo(1)); 56 Expect.equals('AA.foo(1, A)', inscrutable(a).foo(1));
60 Expect.equals('AA.foo(2, 3)', inscrutable(a).foo(2, 3)); 57 Expect.equals('AA.foo(2, 3)', inscrutable(a).foo(2, 3));
(...skipping 14 matching lines...) Expand all
75 72
76 Expect.equals('AA.foo(1, A)', afoo(1)); 73 Expect.equals('AA.foo(1, A)', afoo(1));
77 Expect.equals('AA.foo(2, 3)', afoo(2, 3)); 74 Expect.equals('AA.foo(2, 3)', afoo(2, 3));
78 75
79 Expect.equals('BB.foo(1, B)', bfoo(1)); 76 Expect.equals('BB.foo(1, B)', bfoo(1));
80 Expect.equals('BB.foo(2, 3)', bfoo(2, 3)); 77 Expect.equals('BB.foo(2, 3)', bfoo(2, 3));
81 78
82 Expect.equals('CC.foo(1, C)', cfoo(1)); 79 Expect.equals('CC.foo(1, C)', cfoo(1));
83 Expect.equals('CC.foo(2, 3)', cfoo(2, 3)); 80 Expect.equals('CC.foo(2, 3)', cfoo(2, 3));
84 } 81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698