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: frog/tests/native/src/NativeUseNativeNameInTableFrogTest.dart

Issue 10250002: test rename overhaul: step 5 - frog and leg tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test that we put native names and not Dart names into the dynamic
6 // dispatch table.
7
8 class A native "*NativeA" {
9 foo() native;
10 }
11
12 class B extends A native "*NativeB" {
13 }
14
15 A makeA() native { return new A(); }
16 B makeB() native { return new B(); }
17
18 void setup() native """
19 function inherits(child, parent) {
20 if (child.prototype.__proto__) {
21 child.prototype.__proto__ = parent.prototype;
22 } else {
23 function tmp() {};
24 tmp.prototype = parent.prototype;
25 child.prototype = new tmp();
26 child.prototype.constructor = child;
27 }
28 }
29 function NativeA() {}
30 function NativeB() {}
31 inherits(NativeB, NativeA);
32 NativeA.prototype.foo = function() { return 42; };
33
34 makeA = function(){return new NativeA;};
35 makeB = function(){return new NativeB;};
36 """;
37
38
39 main() {
40 setup();
41
42 var a = makeA();
43 Expect.equals(42, a.foo());
44 A aa = a;
45 Expect.equals(42, aa.foo());
46
47 var b = makeB();
48 Expect.equals(42, b.foo());
49 B bb = b;
50 Expect.equals(42, bb.foo());
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698