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

Side by Side Diff: tests/compiler/dart2js_native/native_use_native_name_in_table_frog_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) 2012, the Dart project authors. Please see the AUTHORS file 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 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 that we put native names and not Dart names into the dynamic 8 // Test that we put native names and not Dart names into the dynamic
8 // dispatch table. 9 // dispatch table.
9 10
10 @Native("NativeA") 11 @Native("NativeA")
11 class A { 12 class A {
12 foo() native ; 13 foo() native ;
13 } 14 }
14 15
15 @Native("NativeB") 16 @Native("NativeB")
(...skipping 13 matching lines...) Expand all
29 child.prototype.constructor = child; 30 child.prototype.constructor = child;
30 } 31 }
31 } 32 }
32 function NativeA() {} 33 function NativeA() {}
33 function NativeB() {} 34 function NativeB() {}
34 inherits(NativeB, NativeA); 35 inherits(NativeB, NativeA);
35 NativeA.prototype.foo = function() { return 42; }; 36 NativeA.prototype.foo = function() { return 42; };
36 37
37 makeA = function(){return new NativeA;}; 38 makeA = function(){return new NativeA;};
38 makeB = function(){return new NativeB;}; 39 makeB = function(){return new NativeB;};
39
40 self.nativeConstructor(NativeA);
41 self.nativeConstructor(NativeB);
42 """; 40 """;
43 41
44 main() { 42 main() {
45 nativeTesting();
46 setup(); 43 setup();
47 44
48 Expect.equals(42, makeA().foo()); 45 var a = makeA();
49 Expect.equals(42, confuse(makeA()).foo()); 46 Expect.equals(42, a.foo());
47 A aa = a;
48 Expect.equals(42, aa.foo());
50 49
51 Expect.equals(42, makeB().foo()); 50 var b = makeB();
52 Expect.equals(42, confuse(makeB()).foo()); 51 Expect.equals(42, b.foo());
52 B bb = b;
53 Expect.equals(42, bb.foo());
53 } 54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698