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

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

Issue 2379173002: Add native_testing library to mock @Native classes (Closed)
Patch Set: xxx Created 4 years, 1 month 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 5e494d45dcdf78f69d4fcc57d0bac4c6ffb26f39..f2ada1e9ce5597a2746808c379e2af4376d03883 100644
--- a/tests/compiler/dart2js_native/browser_compat_1_unpatched_test.dart
+++ b/tests/compiler/dart2js_native/browser_compat_1_unpatched_test.dart
@@ -2,10 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import "dart:_js_helper";
-import "package:expect/expect.dart";
-//import 'dart:_foreign_helper' show JS;
-//import 'dart:_js_helper' show Creates, setNativeSubclassDispatchRecord;
+import "native_testing.dart";
// Test for dartNativeDispatchHooksTransformer, getTag hook.
// Same as browser_compat_1_prepatched_test but with prepatching disabled.
@@ -43,6 +40,10 @@ makeT1A = function(){return new T1A;};
makeT1B = function(){return new T1CrazyB;};
makeT1C = function(){return new T1fakeA;};
+self.nativeConstructor(T1A);
+self.nativeConstructor(T1CrazyB);
+self.nativeConstructor(T1fakeA);
+
var getTagCount = 0;
getTagCallCount = function() { return getTagCount; }
@@ -72,11 +73,9 @@ function transformer1(hooks) {
dartNativeDispatchHooksTransformer = [transformer1];
''';
-var inscrutable;
-
main() {
+ nativeTesting();
setup();
- inscrutable = (x) => x;
var t1a = makeT1A();
var t1b = makeT1B();
@@ -88,9 +87,9 @@ main() {
Expect.equals(3, getTagCallCount());
- Expect.equals(true, inscrutable(t1a) is T1A, '$t1a is T1A');
- Expect.equals(true, inscrutable(t1b) is T1B, '$t1b is T1B');
- Expect.equals(true, inscrutable(t1c) is T1C, '$t1c is T1C');
+ Expect.equals(true, confuse(t1a) is T1A, '$t1a is T1A');
+ Expect.equals(true, confuse(t1b) is T1B, '$t1b is T1B');
+ Expect.equals(true, confuse(t1c) is T1C, '$t1c is T1C');
Expect.equals(3, getTagCallCount());
}

Powered by Google App Engine
This is Rietveld 408576698