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

Side by Side Diff: tests/compiler/dart2js_native/super_property_test.dart

Issue 2379173002: Add native_testing library to mock @Native classes (Closed)
Patch Set: xxx Created 4 years, 1 month 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "dart:_js_helper"; 5 import "native_testing.dart";
6 import "package:expect/expect.dart";
7 6
8 // Tests super setter where the HInvokeSuper is using interceptor aka 7 // Tests super setter where the HInvokeSuper is using interceptor aka
9 // explicit-receiver calling convention. 8 // explicit-receiver calling convention.
10 9
11 @Native("A") 10 @Native("A")
12 class A { 11 class A {
13 var foo; 12 var foo;
14 get_foo() => foo; 13 get_foo() => foo;
15 set bar(value) => foo = value; 14 set bar(value) => foo = value;
16 } 15 }
(...skipping 23 matching lines...) Expand all
40 39
41 makeA() native ; 40 makeA() native ;
42 makeB() native ; 41 makeB() native ;
43 42
44 void setup() native """ 43 void setup() native """
45 // This code is all inside 'setup' and so not accesible from the global scope. 44 // This code is all inside 'setup' and so not accesible from the global scope.
46 function A(){} 45 function A(){}
47 function B(){} 46 function B(){}
48 makeA = function(){return new A}; 47 makeA = function(){return new A};
49 makeB = function(){return new B}; 48 makeB = function(){return new B};
49 self.nativeConstructor(A);
50 self.nativeConstructor(B);
50 """; 51 """;
51 52
52 testThing(a) { 53 testThing(a) {
53 a.foo = 123; 54 a.foo = 123;
54 Expect.equals(123, a.foo); 55 Expect.equals(123, a.foo);
55 Expect.equals(123, a.get_foo()); 56 Expect.equals(123, a.get_foo());
56 57
57 a.bar = 234; 58 a.bar = 234;
58 Expect.equals(234, a.foo); 59 Expect.equals(234, a.foo);
59 Expect.equals(234, a.get_foo()); 60 Expect.equals(234, a.get_foo());
60 } 61 }
61 62
62 main() { 63 main() {
64 nativeTesting();
63 setup(); 65 setup();
64 var things = [makeA(), makeB(), new C(), new D()]; 66 var things = [makeA(), makeB(), new C(), new D()];
65 var test = testThing; 67 var test = testThing;
66 test(things[0]); 68 test(things[0]);
67 test(things[1]); 69 test(things[1]);
68 test(things[2]); 70 test(things[2]);
69 test(things[3]); 71 test(things[3]);
70 } 72 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_native/super_call_test.dart ('k') | tests/compiler/dart2js_native/type_error_decode_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698