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

Unified Diff: tests/compiler/dart2js_native/native_class_fields_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/native_class_fields_2_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_fields_2_test.dart b/tests/compiler/dart2js_native/native_class_fields_2_test.dart
index 419d82fc8ea05d46751e566c7d3cb968c692f23f..efd43986d714404d3c52d4bcedf35f603d6e121b 100644
--- a/tests/compiler/dart2js_native/native_class_fields_2_test.dart
+++ b/tests/compiler/dart2js_native/native_class_fields_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";
// Verify that methods are not renamed to clash with native field names
// that are known from the DOM (like x, y, z).
@@ -23,7 +22,7 @@ function getter() {
function A(){
var a = Object.create(
- { constructor: { name: 'A'}},
+ { constructor: A },
{ x: { get: getter, configurable: false, writeable: false },
y: { get: getter, configurable: false, writeable: false },
z: { get: getter, configurable: false, writeable: false }
@@ -33,6 +32,7 @@ function A(){
}
makeA = function() { return new A; };
+self.nativeConstructor(A);
""";
A makeA() native ;
@@ -72,9 +72,10 @@ class B {
int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
main() {
+ nativeTesting();
setup();
- var both = [makeA(), new B()];
- var x = both[inscrutable(0)];
+ confuse(new B()).a();
+ var x = confuse(makeA());
// Each of these will throw, because an instance of A doesn't have any of
// these functions. The important thing is that none of them have been
// renamed to be called 'z' by the minifier, because then the getter will be

Powered by Google App Engine
This is Rietveld 408576698