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

Side by Side Diff: tests/compiler/dart2js_native/native_class_is_check3_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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 for correct simple is-checks on hidden native classes. 8 // Test for correct simple is-checks on hidden native classes.
8 9
9 abstract class J {} 10 abstract class J {}
10 11
11 abstract class I extends J { 12 abstract class I extends J {
12 I read(); 13 I read();
13 write(I x); 14 write(I x);
14 } 15 }
15 16
(...skipping 24 matching lines...) Expand all
40 child.prototype.constructor = child; 41 child.prototype.constructor = child;
41 } 42 }
42 } 43 }
43 function A(){} 44 function A(){}
44 function B(){} 45 function B(){}
45 inherits(B, A); 46 inherits(B, A);
46 A.prototype.read = function() { return this._x; }; 47 A.prototype.read = function() { return this._x; };
47 A.prototype.write = function(x) { this._x = x; }; 48 A.prototype.write = function(x) { this._x = x; };
48 makeA = function(){return new A}; 49 makeA = function(){return new A};
49 makeB = function(){return new B}; 50 makeB = function(){return new B};
50 self.nativeConstructor(A);
51 self.nativeConstructor(B);
52 """; 51 """;
53 52
54 class C {} 53 class C {}
55 54
56 main() { 55 main() {
57 nativeTesting();
58 setup(); 56 setup();
59 57
60 var a1 = makeA(); 58 var a1 = makeA();
61 var b1 = makeB(); 59 var b1 = makeB();
62 var ob = new Object(); 60 var ob = new Object();
63 61
64 Expect.isFalse(ob is J); 62 Expect.isFalse(ob is J);
65 Expect.isFalse(ob is I); 63 Expect.isFalse(ob is I);
66 Expect.isFalse(ob is A); 64 Expect.isFalse(ob is A);
67 Expect.isFalse(ob is B); 65 Expect.isFalse(ob is B);
68 Expect.isFalse(ob is C); 66 Expect.isFalse(ob is C);
69 67
70 // Use b1 first to prevent a1 is checks patching the A prototype. 68 // Use b1 first to prevent a1 is checks patching the A prototype.
71 Expect.isTrue(b1 is J); 69 Expect.isTrue(b1 is J);
72 Expect.isTrue(b1 is I); 70 Expect.isTrue(b1 is I);
73 Expect.isTrue(b1 is A); 71 Expect.isTrue(b1 is A);
74 Expect.isTrue(b1 is B); 72 Expect.isTrue(b1 is B);
75 Expect.isTrue(b1 is! C); 73 Expect.isTrue(b1 is! C);
76 74
77 Expect.isTrue(a1 is J); 75 Expect.isTrue(a1 is J);
78 Expect.isTrue(a1 is I); 76 Expect.isTrue(a1 is I);
79 Expect.isTrue(a1 is A); 77 Expect.isTrue(a1 is A);
80 Expect.isTrue(a1 is! B); 78 Expect.isTrue(a1 is! B);
81 Expect.isTrue(a1 is! C); 79 Expect.isTrue(a1 is! C);
82 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698