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

Side by Side Diff: tests/compiler/dart2js_native/subclassing_super_call_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 for super access from classes that extend native classes. 10 // Test for super access from classes that extend native classes.
(...skipping 24 matching lines...) Expand all
35 get afield => super.afield; 35 get afield => super.afield;
36 set afield(value) => super.afield = value; 36 set afield(value) => super.afield = value;
37 afun() => super.afun(); 37 afun() => super.afun();
38 } 38 }
39 39
40 BB makeBB() native; 40 BB makeBB() native;
41 41
42 @Creates('=Object') 42 @Creates('=Object')
43 getBBPrototype() native; 43 getBBPrototype() native;
44 44
45 void setup() native r""" 45 void setup() {
46 function N2() {} 46 JS('', r"""
47 N2.prototype.foo = function() { return "foo:" + this.text; } 47 (function(){
48 function BB() {} 48 function N2() {}
49 BB.prototype.__proto__ = N2.prototype; 49 N2.prototype.foo = function() { return "foo:" + this.text; };
50 makeBB = function(){return new BB;}; 50 function BB() {}
51 BB.prototype.__proto__ = N2.prototype;
52 makeBB = function(){return new BB()};
51 53
52 getBBPrototype = function(){return BB.prototype;}; 54 getBBPrototype = function(){return BB.prototype;};
53 """; 55 })()""");
56 }
54 57
55 testSuperOnNative() { 58 testSuperOnNative() {
56 BB b1 = makeBB(); 59 BB b1 = makeBB();
57 BB b2 = makeBB(); 60 BB b2 = makeBB();
58 61
59 var constructor = findConstructorForNativeSubclassType(BB, 'init'); 62 var constructor = findConstructorForNativeSubclassType(BB, 'init');
60 Expect.isNotNull(constructor); 63 Expect.isNotNull(constructor);
61 JS('', '#(#)', constructor, b1); 64 JS('', '#(#)', constructor, b1);
62 JS('', '#(#)', constructor, b2); 65 JS('', '#(#)', constructor, b2);
63 66
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 125
123 main() { 126 main() {
124 nativeTesting(); 127 nativeTesting();
125 setup(); 128 setup();
126 129
127 setNativeSubclassDispatchRecord(getBBPrototype(), findInterceptorForType(BB)); 130 setNativeSubclassDispatchRecord(getBBPrototype(), findInterceptorForType(BB));
128 131
129 testSuperOnNative(); 132 testSuperOnNative();
130 testSuperOnSubclassOfNative(); 133 testSuperOnSubclassOfNative();
131 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698