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

Unified Diff: tests/compiler/dart2js_native/browser_compat_1_unpatched_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, 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/browser_compat_1_unpatched_test.dart
diff --git a/tests/compiler/dart2js_native/browser_compat_1_unpatched_test.dart b/tests/compiler/dart2js_native/browser_compat_1_unpatched_test.dart
index f4bfbf532bea6f612748c5152bad8ab9156df514..779b72aa1310a9cd6a92911f21d77093730c3043 100644
--- a/tests/compiler/dart2js_native/browser_compat_1_unpatched_test.dart
+++ b/tests/compiler/dart2js_native/browser_compat_1_unpatched_test.dart
@@ -22,57 +22,60 @@ makeT1C() native;
int getTagCallCount() native;
-void setup() native r'''
-function T1A() { } // Normal native class.
-function T1CrazyB() { } // Native class with different constructor name.
+void setup() {
+ JS('', r"""
+(function(){
+ function T1A() { } // Normal native class.
+ function T1CrazyB() { } // Native class with different constructor name.
-var T1fakeA = (function(){
- function T1A() {} // Native class with adversarial constructor name.
- return T1A;
-})();
+ var T1fakeA = (function(){
+ function T1A() {} // Native class with adversarial constructor name.
+ return T1A;
+ })();
-// Make constructors visible on 'window' for prepatching.
-if (typeof window == "undefined") window = {}
-window.T1A = T1A;
-window.T1CrazyB = T1CrazyB;
+ // Make constructors visible on 'window' for prepatching.
+ if (typeof window == "undefined") window = {};
+ window.T1A = T1A;
+ window.T1CrazyB = T1CrazyB;
-makeT1A = function(){return new T1A;};
-makeT1B = function(){return new T1CrazyB;};
-makeT1C = function(){return new T1fakeA;};
+ makeT1A = function(){return new T1A()};
+ makeT1B = function(){return new T1CrazyB()};
+ makeT1C = function(){return new T1fakeA()};
-self.nativeConstructor(T1A);
-self.nativeConstructor(T1CrazyB);
-self.nativeConstructor(T1fakeA);
+ self.nativeConstructor(T1A);
+ self.nativeConstructor(T1CrazyB);
+ self.nativeConstructor(T1fakeA);
-var getTagCount = 0;
-getTagCallCount = function() { return getTagCount; }
+ var getTagCount = 0;
+ getTagCallCount = function() { return getTagCount; };
-function transformer1(hooks) {
- var getTag = hooks.getTag;
+ function transformer1(hooks) {
+ var getTag = hooks.getTag;
- function getTagNew(obj) {
- ++getTagCount;
+ function getTagNew(obj) {
+ ++getTagCount;
- // If something looks like a different native type we can check in advance
- // of the default algorithm.
- if (obj instanceof T1fakeA) return "T1C";
+ // If something looks like a different native type we can check in advance
+ // of the default algorithm.
+ if (obj instanceof T1fakeA) return "T1C";
- var tag = getTag(obj);
+ var tag = getTag(obj);
- // New constructor names can be mapped here.
- if (tag == "T1CrazyB") return "T1B";
+ // New constructor names can be mapped here.
+ if (tag == "T1CrazyB") return "T1B";
- return tag;
+ return tag;
+ }
+
+ hooks.getTag = getTagNew;
+ // Disable prepatching.
+ hooks.prototypeForTag = function() { return null; }
}
- hooks.getTag = getTagNew;
- // Disable prepatching.
- hooks.prototypeForTag = function() { return null; }
+ dartNativeDispatchHooksTransformer = [transformer1];
+})()""");
}
-dartNativeDispatchHooksTransformer = [transformer1];
-''';
-
main() {
nativeTesting();
setup();

Powered by Google App Engine
This is Rietveld 408576698