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

Side by Side Diff: tests/compiler/dart2js_native/native_class_inheritance3_frog_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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Test to see if resolving a hidden native class's method to noSuchMethod 8 // Test to see if resolving a hidden native class's method to noSuchMethod
8 // interferes with subsequent resolving of the method. This might happen if the 9 // interferes with subsequent resolving of the method. This might happen if the
9 // noSuchMethod is cached on Object.prototype. 10 // noSuchMethod is cached on Object.prototype.
10 11
11 @Native("A1") 12 @Native("A1")
12 class A1 {} 13 class A1 {}
13 14
14 @Native("B1") 15 @Native("B1")
15 class B1 extends A1 {} 16 class B1 extends A1 {}
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 52
52 function A2(){} 53 function A2(){}
53 function B2(){} 54 function B2(){}
54 inherits(B2, A2); 55 inherits(B2, A2);
55 A2.prototype.foo = function(a){return 'A2.foo(' + a + ')';} 56 A2.prototype.foo = function(a){return 'A2.foo(' + a + ')';}
56 57
57 makeA2 = function(){return new A2}; 58 makeA2 = function(){return new A2};
58 makeB2 = function(){return new B2}; 59 makeB2 = function(){return new B2};
59 60
60 makeObject = function(){return new Object}; 61 makeObject = function(){return new Object};
61
62 self.nativeConstructor(A1);
63 self.nativeConstructor(A2);
64 self.nativeConstructor(B1);
65 self.nativeConstructor(B2);
66 """; 62 """;
67 63
68 main() { 64 main() {
69 nativeTesting();
70 setup(); 65 setup();
71 66
72 var a1 = makeA1(); 67 var a1 = makeA1();
73 var b1 = makeB1(); 68 var b1 = makeB1();
74 var ob = makeObject(); 69 var ob = makeObject();
75 70
76 // Does calling missing methods in one tree of inheritance forest affect other 71 // Does calling missing methods in one tree of inheritance forest affect other
77 // trees? 72 // trees?
78 expectNoSuchMethod(() => b1.foo(), 'b1.foo()'); 73 expectNoSuchMethod(() => b1.foo(), 'b1.foo()');
79 expectNoSuchMethod(() => a1.foo(), 'a1.foo()'); 74 expectNoSuchMethod(() => a1.foo(), 'a1.foo()');
(...skipping 14 matching lines...) Expand all
94 expectNoSuchMethod(action, note) { 89 expectNoSuchMethod(action, note) {
95 bool caught = false; 90 bool caught = false;
96 try { 91 try {
97 action(); 92 action();
98 } catch (ex) { 93 } catch (ex) {
99 caught = true; 94 caught = true;
100 Expect.isTrue(ex is NoSuchMethodError, note); 95 Expect.isTrue(ex is NoSuchMethodError, note);
101 } 96 }
102 Expect.isTrue(caught, note); 97 Expect.isTrue(caught, note);
103 } 98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698