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

Unified Diff: tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart

Issue 2984403002: dart2js_native tests: Migrate 'native STRING' to JS-calls (Closed)
Patch Set: the rest of the files Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart b/tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart
index e187f68f9d39e1f63ea90acba6cd1e2cdfae6008..3691959a3348eee522d7154b49c58aa44d5e34db 100644
--- a/tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart
+++ b/tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart
@@ -37,41 +37,44 @@ class B2 extends A2 {
makeA2() native;
makeB2() native;
-void setup() native """
-// This code is all inside 'setup' and so not accessible from the global scope.
-function inherits(child, parent) {
- if (child.prototype.__proto__) {
- child.prototype.__proto__ = parent.prototype;
- } else {
- function tmp() {};
- tmp.prototype = parent.prototype;
- child.prototype = new tmp();
- child.prototype.constructor = child;
+void setup() {
+ JS('', r"""
+(function(){
+ // This code is inside 'setup' and so not accessible from the global scope.
+ function inherits(child, parent) {
+ if (child.prototype.__proto__) {
+ child.prototype.__proto__ = parent.prototype;
+ } else {
+ function tmp() {};
+ tmp.prototype = parent.prototype;
+ child.prototype = new tmp();
+ child.prototype.constructor = child;
+ }
}
+ function A1(){}
+ function B1(){}
+ inherits(B1, A1);
+ A1.prototype.foo = function(){return 100;};
+ B1.prototype.foo = function(){return 200;};
+
+ makeA1 = function(){return new A1()};
+ makeB1 = function(){return new B1()};
+
+ function A2(){}
+ function B2(){}
+ inherits(B2, A2);
+ A2.prototype.foo = function(a){return a + 10000;};
+ B2.prototype.foo = function(z){return z + 20000;};
+
+ makeA2 = function(){return new A2()};
+ makeB2 = function(){return new B2()};
+
+ self.nativeConstructor(A1);
+ self.nativeConstructor(A2);
+ self.nativeConstructor(B1);
+ self.nativeConstructor(B2);
+})()""");
}
-function A1(){}
-function B1(){}
-inherits(B1, A1);
-A1.prototype.foo = function(){return 100;}
-B1.prototype.foo = function(){return 200;}
-
-makeA1 = function(){return new A1};
-makeB1 = function(){return new B1};
-
-function A2(){}
-function B2(){}
-inherits(B2, A2);
-A2.prototype.foo = function(a){return a + 10000;}
-B2.prototype.foo = function(z){return z + 20000;}
-
-makeA2 = function(){return new A2};
-makeB2 = function(){return new B2};
-
-self.nativeConstructor(A1);
-self.nativeConstructor(A2);
-self.nativeConstructor(B1);
-self.nativeConstructor(B2);
-""";
main() {
nativeTesting();

Powered by Google App Engine
This is Rietveld 408576698