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

Side by Side Diff: runtime/observatory/tests/service/weak_properties_test.dart

Issue 1133733005: Use words please. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: also rename service rpc Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/observatory/tests/service/string_escaping_test.dart ('k') | runtime/vm/service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override 4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override
5 5
6 library vm_references_test; 6 library vm_references_test;
7 7
8 import 'dart:mirrors'; 8 import 'dart:mirrors';
9 import 'package:observatory/service_io.dart'; 9 import 'package:observatory/service_io.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 17 matching lines...) Expand all
28 LibraryMirror libcore = expandoMirror.type.owner; 28 LibraryMirror libcore = expandoMirror.type.owner;
29 29
30 var entries = expandoMirror.getField(MirrorSystem.getSymbol('_data', libcore)) .reflectee; 30 var entries = expandoMirror.getField(MirrorSystem.getSymbol('_data', libcore)) .reflectee;
31 weak_property = entries.singleWhere((e) => e != null); 31 weak_property = entries.singleWhere((e) => e != null);
32 print(weak_property); 32 print(weak_property);
33 } 33 }
34 34
35 var tests = [ 35 var tests = [
36 36
37 (Isolate isolate) => 37 (Isolate isolate) =>
38 isolate.rootLib.load().then((Library lib) { 38 isolate.rootLibrary.load().then((Library lib) {
39 Field keyField = lib.variables.singleWhere((v) => v.name == 'key'); 39 Field keyField = lib.variables.singleWhere((v) => v.name == 'key');
40 Instance key = keyField.value; 40 Instance key = keyField.value;
41 Field valueField = lib.variables.singleWhere((v) => v.name == 'value'); 41 Field valueField = lib.variables.singleWhere((v) => v.name == 'value');
42 Instance value = valueField.value; 42 Instance value = valueField.value;
43 Field propField = lib.variables.singleWhere((v) => v.name == 'weak_property' ); 43 Field propField = lib.variables.singleWhere((v) => v.name == 'weak_property' );
44 Instance prop = propField.value; 44 Instance prop = propField.value;
45 45
46 expect(key.isWeakProperty, isFalse); 46 expect(key.isWeakProperty, isFalse);
47 expect(value.isWeakProperty, isFalse); 47 expect(value.isWeakProperty, isFalse);
48 expect(prop.isWeakProperty, isTrue); 48 expect(prop.isWeakProperty, isTrue);
49 expect(prop.key, isNull); 49 expect(prop.key, isNull);
50 expect(prop.value, isNull); 50 expect(prop.value, isNull);
51 return prop.load().then((Instance loadedProp) { 51 return prop.load().then((Instance loadedProp) {
52 // Object ids are not cannonicalized, so we rely on the key and value 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 53 // being the sole instances of their classes to test we got the objects
54 // we expect. 54 // we expect.
55 expect(loadedProp.key, isNotNull); 55 expect(loadedProp.key, isNotNull);
56 expect(loadedProp.key.clazz, equals(key.clazz)); 56 expect(loadedProp.key.clazz, equals(key.clazz));
57 expect(loadedProp.value, isNotNull); 57 expect(loadedProp.value, isNotNull);
58 expect(loadedProp.value.clazz, equals(value.clazz)); 58 expect(loadedProp.value.clazz, equals(value.clazz));
59 }); 59 });
60 }), 60 }),
61 61
62 ]; 62 ];
63 63
64 main(args) => runIsolateTests(args, tests, testeeBefore: script); 64 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/string_escaping_test.dart ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698