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

Unified Diff: tests/compiler/dart2js_native/browser_compat_1_prepatched_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_prepatched_test.dart
diff --git a/tests/compiler/dart2js_native/browser_compat_1_prepatched_test.dart b/tests/compiler/dart2js_native/browser_compat_1_prepatched_test.dart
index 40662d84d50489c0f0367387bd63467b5ee2b295..606d4b1a4cc6381fecd9b41b57afd9fe5ab9bdda 100644
--- a/tests/compiler/dart2js_native/browser_compat_1_prepatched_test.dart
+++ b/tests/compiler/dart2js_native/browser_compat_1_prepatched_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.
@@ -42,6 +39,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; }
@@ -69,11 +70,9 @@ function transformer1(hooks) {
dartNativeDispatchHooksTransformer = [transformer1];
''';
-var inscrutable;
-
main() {
+ nativeTesting();
setup();
- inscrutable = (x) => x;
var t1a = makeT1A();
var t1b = makeT1B();
@@ -85,9 +84,9 @@ main() {
Expect.equals(2, 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(2, getTagCallCount());
}

Powered by Google App Engine
This is Rietveld 408576698