OLD | NEW |
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 "dart:_js_helper"; |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 //import 'dart:_foreign_helper' show JS; | 7 //import 'dart:_foreign_helper' show JS; |
8 //import 'dart:_js_helper' show Creates, setNativeSubclassDispatchRecord; | 8 //import 'dart:_js_helper' show Creates, setNativeSubclassDispatchRecord; |
9 | 9 |
10 // Test for dartNativeDispatchHooksTransformer, getTag hook. | 10 // Test for dartNativeDispatchHooksTransformer, getTag hook. |
11 | 11 |
12 @Native("T1A") | 12 @Native("T1A") |
13 class T1A { | 13 class T1A {} |
14 } | |
15 | 14 |
16 @Native("T1B") | 15 @Native("T1B") |
17 class T1B { | 16 class T1B {} |
18 } | |
19 | 17 |
20 @Native("T1C") | 18 @Native("T1C") |
21 class T1C { | 19 class T1C {} |
22 } | |
23 | 20 |
24 makeT1A() native; | 21 makeT1A() native ; |
25 makeT1B() native; | 22 makeT1B() native ; |
26 makeT1C() native; | 23 makeT1C() native ; |
27 | 24 |
28 int getTagCallCount() native; | 25 int getTagCallCount() native ; |
29 | 26 |
30 void setup() native r''' | 27 void setup() native r''' |
31 function T1A() { } // Normal native class. | 28 function T1A() { } // Normal native class. |
32 function T1CrazyB() { } // Native class with different constructor name. | 29 function T1CrazyB() { } // Native class with different constructor name. |
33 | 30 |
34 var T1fakeA = (function(){ | 31 var T1fakeA = (function(){ |
35 function T1A() {} // Native class with adversarial constructor name. | 32 function T1A() {} // Native class with adversarial constructor name. |
36 return T1A; | 33 return T1A; |
37 })(); | 34 })(); |
38 | 35 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 Expect.equals(true, t1c is T1C, '$t1c is T1C'); | 84 Expect.equals(true, t1c is T1C, '$t1c is T1C'); |
88 | 85 |
89 Expect.equals(2, getTagCallCount()); | 86 Expect.equals(2, getTagCallCount()); |
90 | 87 |
91 Expect.equals(true, inscrutable(t1a) is T1A, '$t1a is T1A'); | 88 Expect.equals(true, inscrutable(t1a) is T1A, '$t1a is T1A'); |
92 Expect.equals(true, inscrutable(t1b) is T1B, '$t1b is T1B'); | 89 Expect.equals(true, inscrutable(t1b) is T1B, '$t1b is T1B'); |
93 Expect.equals(true, inscrutable(t1c) is T1C, '$t1c is T1C'); | 90 Expect.equals(true, inscrutable(t1c) is T1C, '$t1c is T1C'); |
94 | 91 |
95 Expect.equals(2, getTagCallCount()); | 92 Expect.equals(2, getTagCallCount()); |
96 } | 93 } |
OLD | NEW |