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

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

Issue 979823003: Major rework of vm service events. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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) 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 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'package:observatory/object_graph.dart'; 6 import 'package:observatory/object_graph.dart';
7 import 'package:observatory/service_io.dart'; 7 import 'package:observatory/service_io.dart';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 import 'test_helper.dart'; 9 import 'test_helper.dart';
10 10
(...skipping 21 matching lines...) Expand all
32 lst[1] = new List(123456); 32 lst[1] = new List(123456);
33 } 33 }
34 34
35 int fooId; 35 int fooId;
36 36
37 var tests = [ 37 var tests = [
38 38
39 (Isolate isolate) { 39 (Isolate isolate) {
40 Completer completer = new Completer(); 40 Completer completer = new Completer();
41 isolate.vm.events.stream.listen((ServiceEvent event) { 41 isolate.vm.events.stream.listen((ServiceEvent event) {
42 if (event.eventType == '_Graph') { 42 if (event.eventType == ServiceEvent.kGraph) {
43 ReadStream reader = new ReadStream(event.data); 43 ReadStream reader = new ReadStream(event.data);
44 ObjectGraph graph = new ObjectGraph(reader); 44 ObjectGraph graph = new ObjectGraph(reader);
45 expect(fooId, isNotNull); 45 expect(fooId, isNotNull);
46 Iterable<ObjectVertex> foos = graph.vertices.where( 46 Iterable<ObjectVertex> foos = graph.vertices.where(
47 (ObjectVertex obj) => obj.classId == fooId); 47 (ObjectVertex obj) => obj.classId == fooId);
48 expect(foos.length, equals(3)); 48 expect(foos.length, equals(3));
49 expect(foos.where( 49 expect(foos.where(
50 (ObjectVertex obj) => obj.succ.length == 0).length, equals(1)); 50 (ObjectVertex obj) => obj.succ.length == 0).length, equals(1));
51 expect(foos.where( 51 expect(foos.where(
52 (ObjectVertex obj) => obj.succ.length == 1).length, equals(1)); 52 (ObjectVertex obj) => obj.succ.length == 1).length, equals(1));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 Class fooClass = lib.classes.first; 89 Class fooClass = lib.classes.first;
90 fooId = fooClass.vmCid; 90 fooId = fooClass.vmCid;
91 isolate.invokeRpcNoUpgrade('requestHeapSnapshot', {}); 91 isolate.invokeRpcNoUpgrade('requestHeapSnapshot', {});
92 return completer.future; 92 return completer.future;
93 }); 93 });
94 }, 94 },
95 95
96 ]; 96 ];
97 97
98 main(args) => runIsolateTests(args, tests, testeeBefore: script); 98 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW
« no previous file with comments | « runtime/observatory/test/gc_test.dart ('k') | runtime/observatory/test/isolate_lifecycle_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698