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

Side by Side Diff: tests/compiler/dart2js_native/native_null_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 values of some basic types. 8 // Test for values of some basic types.
8 9
9 @Native("A") 10 @Native("A")
10 class A { 11 class A {
11 returnNull() native ; 12 returnNull() native ;
12 returnUndefined() native ; 13 returnUndefined() native ;
13 returnEmptyString() native ; 14 returnEmptyString() native ;
14 returnZero() native ; 15 returnZero() native ;
15 } 16 }
16 17
17 A makeA() native ; 18 A makeA() native ;
18 19
19 void setup() native """ 20 void setup() native """
20 function A() {} 21 function A() {}
21 A.prototype.returnNull = function() { return null; }; 22 A.prototype.returnNull = function() { return null; };
22 A.prototype.returnUndefined = function() { return void 0; }; 23 A.prototype.returnUndefined = function() { return void 0; };
23 A.prototype.returnEmptyString = function() { return ""; }; 24 A.prototype.returnEmptyString = function() { return ""; };
24 A.prototype.returnZero = function() { return 0; }; 25 A.prototype.returnZero = function() { return 0; };
25 makeA = function(){return new A;}; 26 makeA = function(){return new A;};
26 self.nativeConstructor(A);
27 """; 27 """;
28 28
29 @NoInline() 29 main() {
30 staticTests() { 30 setup();
31 A a = makeA(); 31 A a = makeA();
32 Expect.equals(null, a.returnNull()); 32 Expect.equals(null, a.returnNull());
33 Expect.equals(null, a.returnUndefined()); 33 Expect.equals(null, a.returnUndefined());
34 34
35 Expect.equals('', a.returnEmptyString()); 35 Expect.equals('', a.returnEmptyString());
36 Expect.isTrue(a.returnEmptyString().isEmpty); 36 Expect.isTrue(a.returnEmptyString().isEmpty);
37 Expect.isTrue(a.returnEmptyString() is String); 37 Expect.isTrue(a.returnEmptyString() is String);
38 38
39 Expect.isTrue(a.returnZero() is int); 39 Expect.isTrue(a.returnZero() is int);
40 Expect.equals(0, a.returnZero()); 40 Expect.equals(0, a.returnZero());
41 } 41 }
42
43 @NoInline()
44 dynamicTests() {
45 A a = makeA();
46 Expect.equals(null, confuse(a).returnNull());
47 Expect.equals(null, confuse(a).returnUndefined());
48
49 Expect.equals('', confuse(a).returnEmptyString());
50 Expect.isTrue(confuse(a).returnEmptyString().isEmpty);
51 Expect.isTrue(confuse(a).returnEmptyString() is String);
52
53 Expect.isTrue(confuse(a).returnZero() is int);
54 Expect.equals(0, confuse(a).returnZero());
55 }
56
57 main() {
58 nativeTesting();
59 setup();
60 staticTests();
61 dynamicTests();
62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698