Chromium Code Reviews| Index: runtime/bin/vmservice/observatory/test/allocations_test.dart |
| =================================================================== |
| --- runtime/bin/vmservice/observatory/test/allocations_test.dart (revision 39035) |
| +++ runtime/bin/vmservice/observatory/test/allocations_test.dart (working copy) |
| @@ -4,29 +4,30 @@ |
| library allocations_test; |
| -import 'test_helper.dart'; |
| import 'package:observatory/service_io.dart'; |
| import 'package:unittest/unittest.dart'; |
| +import 'test_helper.dart'; |
| -import 'dart:io'; |
| +class Foo { |
| +} |
| +List<Foo> foos; |
| -main() { |
| - String script = 'allocations_script.dart'; |
| - var process = new TestLauncher(script); |
| - process.launch().then((port) { |
| - String addr = 'ws://localhost:$port/ws'; |
| - new WebSocketVM(new WebSocketVMTarget(addr)).get('vm') |
| - .then((VM vm) => vm.isolates.first.load()) |
| - .then((Isolate isolate) => isolate.rootLib.load()) |
| - .then((Library lib) { |
| - expect(lib.url.endsWith(script), isTrue); |
| - return lib.classes.first.load(); |
| - }) |
| - .then((Class fooClass) { |
| - expect(fooClass.name, equals('Foo')); |
| - expect(fooClass.newSpace.accumulated.instances + |
| - fooClass.oldSpace.accumulated.instances, equals(3)); |
| - exit(0); |
| - }); |
| - }); |
| +void script() { |
| + foos = [new Foo(), new Foo(), new Foo()]; |
| } |
| + |
| +var tests = [ |
| + |
| +(Isolate isolate) => |
| + isolate.rootLib.load().then((Library lib) { |
| + expect(lib.url.endsWith('allocations_test.dart'), isTrue); |
| + return lib.classes.first.load().then((Class fooClass) { |
|
Cutch
2014/08/12 14:33:07
Will 'Foo' always be the first class?
koda
2014/08/12 16:53:08
It's actually the only class; I added an 'expect'.
|
| + expect(fooClass.name, equals('Foo')); |
| + expect(fooClass.newSpace.accumulated.instances + |
| + fooClass.oldSpace.accumulated.instances, equals(3)); |
| + }); |
| +}), |
| + |
| +]; |
| + |
| +main(args) => runIsolateTests(args, tests, testeeBefore: script); |