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

Unified Diff: tests/compiler/dart2js_native/browser_compat_2_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_2_test.dart
diff --git a/tests/compiler/dart2js_native/browser_compat_2_test.dart b/tests/compiler/dart2js_native/browser_compat_2_test.dart
index eeb87fa28d16f726cbf96995a838628af12d01f9..e659ce48075b8520af06874d77a479083e84b524 100644
--- a/tests/compiler/dart2js_native/browser_compat_2_test.dart
+++ b/tests/compiler/dart2js_native/browser_compat_2_test.dart
@@ -2,8 +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 "native_testing.dart";
// Test for dartNativeDispatchHooksTransformer
// - uncached, instance, leaf and interior caching modes.
@@ -63,6 +62,11 @@ makeT1B = function(){return new T1B;};
makeT1C = function(){return new T1C;};
makeT1D = function(){return new T1D;};
+self.nativeConstructor(T1A);
+self.nativeConstructor(T1B);
+self.nativeConstructor(T1C);
+self.nativeConstructor(T1D);
+
var getTagCount = 0;
getTagCallCount = function() { return getTagCount; }
clearTagCallCount = function() { getTagCount = 0; }
@@ -99,11 +103,9 @@ function transformer2(hooks) {
dartNativeDispatchHooksTransformer = [transformer1, transformer2];
''';
-var inscrutable;
-
main() {
+ nativeTesting();
setup();
- inscrutable = (x) => x;
var t1a = makeT1A();
var t1b = makeT1B();
@@ -111,17 +113,17 @@ main() {
var t1d = makeT1D();
clearTagCallCount();
- Expect.equals("aA", inscrutable(t1a).foo(), 't1a is T1A');
- Expect.equals("bB", inscrutable(t1b).foo(), 't1b is T1B');
- Expect.equals("cC", inscrutable(t1c).foo(), 't1c is T1C');
- Expect.equals("dD", inscrutable(t1d).foo(), 't1d is T1D');
+ Expect.equals("aA", confuse(t1a).foo(), 't1a is T1A');
+ Expect.equals("bB", confuse(t1b).foo(), 't1b is T1B');
+ Expect.equals("cC", confuse(t1c).foo(), 't1c is T1C');
+ Expect.equals("dD", confuse(t1d).foo(), 't1d is T1D');
Expect.equals(4, getTagCallCount(), '4 fresh instances / types');
clearTagCallCount();
- Expect.equals("aA", inscrutable(t1a).foo(), 't1a is T1A');
- Expect.equals("bB", inscrutable(t1b).foo(), 't1b is T1B');
- Expect.equals("cC", inscrutable(t1c).foo(), 't1c is T1C');
- Expect.equals("dD", inscrutable(t1d).foo(), 't1d is T1D');
+ Expect.equals("aA", confuse(t1a).foo(), 't1a is T1A');
+ Expect.equals("bB", confuse(t1b).foo(), 't1b is T1B');
+ Expect.equals("cC", confuse(t1c).foo(), 't1c is T1C');
+ Expect.equals("dD", confuse(t1d).foo(), 't1d is T1D');
Expect.equals(1, getTagCallCount(), '1 = 1 uncached + (3 cached)');
t1a = makeT1A();
@@ -130,18 +132,18 @@ main() {
t1d = makeT1D();
clearTagCallCount();
- Expect.equals("aA", inscrutable(t1a).foo(), 't1a is T1A');
- Expect.equals("bB", inscrutable(t1b).foo(), 't1b is T1B');
- Expect.equals("cC", inscrutable(t1c).foo(), 't1c is T1C');
- Expect.equals("dD", inscrutable(t1d).foo(), 't1d is T1D');
+ Expect.equals("aA", confuse(t1a).foo(), 't1a is T1A');
+ Expect.equals("bB", confuse(t1b).foo(), 't1b is T1B');
+ Expect.equals("cC", confuse(t1c).foo(), 't1c is T1C');
+ Expect.equals("dD", confuse(t1d).foo(), 't1d is T1D');
Expect.equals(2, getTagCallCount(),
'2 = 1 fresh instance + 1 uncached (+ 2 proto cached)');
clearTagCallCount();
- Expect.equals("aA", inscrutable(t1a).foo(), 't1a is T1A');
- Expect.equals("bB", inscrutable(t1b).foo(), 't1b is T1B');
- Expect.equals("cC", inscrutable(t1c).foo(), 't1c is T1C');
- Expect.equals("dD", inscrutable(t1d).foo(), 't1d is T1D');
+ Expect.equals("aA", confuse(t1a).foo(), 't1a is T1A');
+ Expect.equals("bB", confuse(t1b).foo(), 't1b is T1B');
+ Expect.equals("cC", confuse(t1c).foo(), 't1c is T1C');
+ Expect.equals("dD", confuse(t1d).foo(), 't1d is T1D');
Expect.equals(1, getTagCallCount(),
'1 = 2 proto cached + 1 instance cached + 1 uncached');
}

Powered by Google App Engine
This is Rietveld 408576698