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

Unified Diff: runtime/tests/vm/dart/isolate_mirror_local_test.dart

Issue 10416050: Remove the partially completed code for remote IsolateMirrors and (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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: runtime/tests/vm/dart/isolate_mirror_local_test.dart
===================================================================
--- runtime/tests/vm/dart/isolate_mirror_local_test.dart (revision 7759)
+++ runtime/tests/vm/dart/isolate_mirror_local_test.dart (working copy)
@@ -2,24 +2,54 @@
// 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.
//
-// Dart test program for checking implemention of IsolateMirror.
+// Dart test program for checking implemention of IsolateMirror when
+// inspecting the current isolate.
-#library('isolate_mirror_self_test');
+#library('isolate_mirror_local_test');
#import('dart:isolate');
#import('dart:mirrors');
ReceivePort rp;
+int global_var = 0;
-void testIsolateMirror(port) {
- isolateMirrorOf(port).then((IsolateMirror mirror) {
- Expect.isTrue(mirror.debugName.contains("main"));
- rp.close();
- });
+// This function will be invoked reflectively.
+int function(int x) {
+ global_var = x;
+ return x + 1;
}
+void testRootLibraryMirror(LibraryMirror lib_mirror) {
+ Expect.equals('isolate_mirror_local_test', lib_mirror.simpleName);
+ Expect.isTrue(lib_mirror.url.contains('isolate_mirror_local_test.dart'));
+
+ // Test library invocation.
+ Expect.equals(0, global_var);
+ lib_mirror.invoke('function', [ 123 ]).then(
+ (InstanceMirror retval) {
+ Expect.equals(123, global_var);
+ Expect.equals(124, retval.simpleValue);
+ rp.close();
+ });
+}
+
+void testLibrariesMap(Map libraries) {
+ // Just look for a couple of well-known libs.
+ LibraryMirror core_lib = libraries['dart:core'];
+ Expect.isTrue(core_lib is LibraryMirror);
+
+ LibraryMirror mirror_lib = libraries['dart:mirrors'];
+ Expect.isTrue(mirror_lib is LibraryMirror);
+}
+
+void testIsolateMirror(IsolateMirror mirror) {
+ Expect.isTrue(mirror.debugName.contains('main'));
+ testRootLibraryMirror(mirror.rootLibrary);
+ testLibrariesMap(mirror.libraries);
+}
+
void main() {
- // Test that I can reflect on myself.
+ // Test that an isolate can reflect on itself.
rp = new ReceivePort();
- testIsolateMirror(rp.toSendPort());
+ isolateMirrorOf(rp.toSendPort()).then(testIsolateMirror);
}
« no previous file with comments | « runtime/tests/vm/dart/isolate_mirror_idle_test.dart ('k') | runtime/tests/vm/dart/isolate_mirror_remote_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698