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

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

Issue 2990083002: dart2js_native tests: Migrate 'native STRING' to JS-calls - part 2/2 (Closed)
Patch Set: remove defunct comments Created 3 years, 4 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) 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 "native_testing.dart"; 5 import "native_testing.dart";
6 import 'dart:_js_helper' show setNativeSubclassDispatchRecord; 6 import 'dart:_js_helper' show setNativeSubclassDispatchRecord;
7 import 'dart:_interceptors' 7 import 'dart:_interceptors'
8 show findInterceptorForType, findConstructorForNativeSubclassType; 8 show findInterceptorForType, findConstructorForNativeSubclassType;
9 9
10 // Test that subclasses of native classes can be initialized by calling the 10 // Test that subclasses of native classes can be initialized by calling the
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 B.three([x]) : super.three(205, x); 53 B.three([x]) : super.three(205, x);
54 54
55 get increment => 20; 55 get increment => 20;
56 } 56 }
57 57
58 makeB() native; 58 makeB() native;
59 59
60 @Creates('=Object') 60 @Creates('=Object')
61 getBPrototype() native; 61 getBPrototype() native;
62 62
63 void setup() native r""" 63 void setup() {
64 function B() { this.a2 = 102; } 64 JS('', r"""
65 (function(){
66 function B() { this.a2 = 102; }
65 67
66 makeB = function(){return new B;}; 68 makeB = function(){return new B()};
67 69
68 getBPrototype = function(){return B.prototype;}; 70 getBPrototype = function(){return B.prototype;};
69 """; 71 })()""");
72 }
70 73
71 test_one() { 74 test_one() {
72 trace = []; 75 trace = [];
73 var constructor = findConstructorForNativeSubclassType(B, 'one'); 76 var constructor = findConstructorForNativeSubclassType(B, 'one');
74 Expect.isNotNull(constructor); 77 Expect.isNotNull(constructor);
75 Expect.isNull(findConstructorForNativeSubclassType(B, 'Missing')); 78 Expect.isNull(findConstructorForNativeSubclassType(B, 'Missing'));
76 79
77 var b = makeB(); 80 var b = makeB();
78 Expect.isTrue(b is B); 81 Expect.isTrue(b is B);
79 // Call constructor to initialize native object. 82 // Call constructor to initialize native object.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return message; 168 return message;
166 }; 169 };
167 170
168 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); 171 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B));
169 172
170 test_one(); 173 test_one();
171 test_two(); 174 test_two();
172 test_three(); 175 test_three();
173 test_new(); 176 test_new();
174 } 177 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_native/subclassing_5_test.dart ('k') | tests/compiler/dart2js_native/subclassing_super_call_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698