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

Side by Side 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, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // Dart test program for checking implemention of IsolateMirror. 5 // Dart test program for checking implemention of IsolateMirror when
6 // inspecting the current isolate.
6 7
7 #library('isolate_mirror_self_test'); 8 #library('isolate_mirror_local_test');
8 9
9 #import('dart:isolate'); 10 #import('dart:isolate');
10 #import('dart:mirrors'); 11 #import('dart:mirrors');
11 12
12 ReceivePort rp; 13 ReceivePort rp;
14 int global_var = 0;
13 15
14 void testIsolateMirror(port) { 16 // This function will be invoked reflectively.
15 isolateMirrorOf(port).then((IsolateMirror mirror) { 17 int function(int x) {
16 Expect.isTrue(mirror.debugName.contains("main")); 18 global_var = x;
17 rp.close(); 19 return x + 1;
18 }); 20 }
21
22 void testRootLibraryMirror(LibraryMirror lib_mirror) {
23 Expect.equals('isolate_mirror_local_test', lib_mirror.simpleName);
24 Expect.isTrue(lib_mirror.url.contains('isolate_mirror_local_test.dart'));
25
26 // Test library invocation.
27 Expect.equals(0, global_var);
28 lib_mirror.invoke('function', [ 123 ]).then(
29 (InstanceMirror retval) {
30 Expect.equals(123, global_var);
31 Expect.equals(124, retval.simpleValue);
32 rp.close();
33 });
34 }
35
36 void testLibrariesMap(Map libraries) {
37 // Just look for a couple of well-known libs.
38 LibraryMirror core_lib = libraries['dart:core'];
39 Expect.isTrue(core_lib is LibraryMirror);
40
41 LibraryMirror mirror_lib = libraries['dart:mirrors'];
42 Expect.isTrue(mirror_lib is LibraryMirror);
43 }
44
45 void testIsolateMirror(IsolateMirror mirror) {
46 Expect.isTrue(mirror.debugName.contains('main'));
47 testRootLibraryMirror(mirror.rootLibrary);
48 testLibrariesMap(mirror.libraries);
19 } 49 }
20 50
21 void main() { 51 void main() {
22 // Test that I can reflect on myself. 52 // Test that an isolate can reflect on itself.
23 rp = new ReceivePort(); 53 rp = new ReceivePort();
24 testIsolateMirror(rp.toSendPort()); 54 isolateMirrorOf(rp.toSendPort()).then(testIsolateMirror);
25 } 55 }
OLDNEW
« 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