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

Side by Side Diff: runtime/observatory/test/weak_properties_test.dart

Issue 839543002: Revert "Build Observatory with runtime" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
« no previous file with comments | « runtime/observatory/test/vm_test.dart ('k') | runtime/observatory/tests/ui/inspector.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
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.
4
5 library vm_references_test;
6
7 import 'dart:async';
8 import 'dart:mirrors';
9 import 'package:observatory/service_io.dart';
10 import 'package:unittest/unittest.dart';
11 import 'test_helper.dart';
12
13 class Foo { }
14 class Bar { }
15
16 var expando;
17 var key;
18 var value;
19 var weak_property;
20
21 void script() {
22 expando = new Expando('some debug name');
23 key = new Foo();
24 value = new Bar();
25 expando[key] = value;
26
27 InstanceMirror expandoMirror = reflect(expando);
28 LibraryMirror libcore = expandoMirror.type.owner;
29
30 var entries = expandoMirror.getField(MirrorSystem.getSymbol('_data', libcore)) .reflectee;
31 weak_property = entries.singleWhere((e) => e != null);
32 print(weak_property);
33 }
34
35 var tests = [
36
37 (Isolate isolate) =>
38 isolate.rootLib.load().then((Library lib) {
39 Field keyField = lib.variables.singleWhere((v) => v.name == 'key');
40 Instance key = keyField.value;
41 Field valueField = lib.variables.singleWhere((v) => v.name == 'value');
42 Instance value = valueField.value;
43 Field propField = lib.variables.singleWhere((v) => v.name == 'weak_property' );
44 Instance prop = propField.value;
45
46 expect(key.isWeakProperty, isFalse);
47 expect(value.isWeakProperty, isFalse);
48 expect(prop.isWeakProperty, isTrue);
49 expect(prop.key, isNull);
50 expect(prop.value, isNull);
51 return prop.load().then((Instance loadedProp) {
52 // Object ids are not cannonicalized, so we rely on the key and value
53 // being the sole instances of their classes to test we got the objects
54 // we expect.
55 expect(loadedProp.key, isNotNull);
56 expect(loadedProp.key.clazz, equals(key.clazz));
57 expect(loadedProp.value, isNotNull);
58 expect(loadedProp.value.clazz, equals(value.clazz));
59 });
60 }),
61
62 ];
63
64 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW
« no previous file with comments | « runtime/observatory/test/vm_test.dart ('k') | runtime/observatory/tests/ui/inspector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698