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

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

Issue 155983004: Fix DOM Isolate affinity for interceptors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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/multiscript_part1_test.dart
diff --git a/tests/compiler/dart2js_native/multiscript_part1_test.dart b/tests/compiler/dart2js_native/multiscript_part1_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7be9c6e2efa7c9d0f20b48848e2890ad88d7968b
--- /dev/null
+++ b/tests/compiler/dart2js_native/multiscript_part1_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// 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 "package:expect/expect.dart";
+
+// Methods on (shared) native classes should have DOM isolate affinity.
+// Test that part1 and part2 can be loaded into the same JavaScript context
+// without conflicts.
+
+class A native "AA" {
+ // [foo] is the same in both isolates but optimized differently.
+ foo(x) => x is String;
+
+ // [bar] has different definitions in the two isolates.
+ bar(x) => 'one:$x';
+}
+
+makeA() native;
+
+void setup() native """
+// Use existing definition if present to force sharing.
+if (typeof AA == "undefined") {
+ AA = function AA() {};
+}
+makeA = function(){return new AA;};
+""";
+
+main() {
+ setup();
+
+ Expect.equals(true, makeA().foo('hi'));
+ Expect.equals('one:hi', makeA().bar('hi'));
+}

Powered by Google App Engine
This is Rietveld 408576698