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

Side by Side Diff: tests/compiler/dart2js_native/native_class_is_check1_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 I { 10 abstract class I {
10 I read(); 11 I read();
11 write(I x); 12 write(I x);
12 } 13 }
13 14
14 // Native implementation. 15 // Native implementation.
15 16
16 @Native("A") 17 @Native("A")
17 class A implements I { 18 class A implements I {
18 // The native class accepts only other native instances. 19 // The native class accepts only other native instances.
19 A read() native ; 20 A read() native ;
20 write(A x) native ; 21 write(A x) native ;
21 } 22 }
22 23
23 makeA() native ; 24 makeA() native ;
24 25
25 void setup() native """ 26 void setup() native """
26 // This code is all inside 'setup' and so not accesible from the global scope. 27 // This code is all inside 'setup' and so not accesible from the global scope.
27 function A(){} 28 function A(){}
28 A.prototype.read = function() { return this._x; }; 29 A.prototype.read = function() { return this._x; };
29 A.prototype.write = function(x) { this._x = x; }; 30 A.prototype.write = function(x) { this._x = x; };
30 makeA = function(){return new A}; 31 makeA = function(){return new A};
31 self.nativeConstructor(A);
32 """; 32 """;
33 33
34 class B {} 34 class B {}
35 35
36 main() { 36 main() {
37 nativeTesting();
38 setup(); 37 setup();
39 38
40 var a1 = makeA(); 39 var a1 = makeA();
41 var ob = new Object(); 40 var ob = new Object();
42 41
43 Expect.isFalse(ob is I); 42 Expect.isFalse(ob is I);
44 Expect.isFalse(ob is A); 43 Expect.isFalse(ob is A);
45 Expect.isFalse(ob is B); 44 Expect.isFalse(ob is B);
46 45
47 Expect.isTrue(a1 is I); 46 Expect.isTrue(a1 is I);
48 Expect.isTrue(a1 is A); 47 Expect.isTrue(a1 is A);
49 Expect.isTrue(a1 is! B); 48 Expect.isTrue(a1 is! B);
50 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698