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

Side by Side Diff: tests/compiler/dart2js_native/native_field_invocation6_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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 makeA() native ; 8 makeA() native ;
8 nativeFirst(x, y) native ; 9 nativeFirst(x, y) native ;
9 10
10 void setup() native """ 11 void setup() native """
11 nativeFirst = function(x, y) { return x; } 12 nativeFirst = function(x, y) { return x; }
12 13
13 function A() {} 14 function A() {}
14 makeA = function() { return new A; } 15 makeA = function() { return new A; }
15 self.nativeConstructor(A);
16 """; 16 """;
17 17
18 @Native("A") 18 @Native("A")
19 class A { 19 class A {
20 var _foo; 20 var _foo;
21 21
22 get foo => _foo; 22 get foo => _foo;
23 23
24 init() { 24 init() {
25 _foo = () => 42; 25 _foo = () => 42;
26 } 26 }
27 } 27 }
28 28
29 class B { 29 class B {
30 var foo = 499; 30 var foo = 499;
31 } 31 }
32 32
33 class C { 33 class C {
34 foo() => 499; 34 foo() => 499;
35 } 35 }
36 36
37 class D { 37 class D {
38 var foo = () => 499; 38 var foo = () => 499;
39 } 39 }
40 40
41 main() { 41 main() {
42 nativeTesting();
43 setup(); 42 setup();
44 var a = makeA(); 43 var a = makeA();
45 a.init(); 44 a.init();
46 var b = new B(); 45 var b = new B();
47 var c = new C(); 46 var c = new C();
48 var d = new D(); 47 var d = new D();
49 a = nativeFirst(a, b); 48 a = nativeFirst(a, b);
50 a = nativeFirst(a, c); 49 a = nativeFirst(a, c);
51 a = nativeFirst(a, d); 50 a = nativeFirst(a, d);
52 // The variable a is still an instance of class A, but dart2js can't infer 51 // The variable a is still an instance of class A, but dart2js can't infer
53 // that anymore. 52 // that anymore.
54 Expect.equals(42, a.foo()); 53 Expect.equals(42, a.foo());
55 } 54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698