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

Side by Side Diff: runtime/bin/vmservice/observatory/test/contexts_test.dart

Issue 544753002: Address static warnings in the service library and tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 library inbound_references_test; 5 library inbound_references_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:observatory/service_io.dart'; 8 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'test_helper.dart'; 10 import 'test_helper.dart';
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 cleanBlock = genCleanBlock(); 45 cleanBlock = genCleanBlock();
46 copyingBlock = genCopyingBlock(); 46 copyingBlock = genCopyingBlock();
47 fullBlock = genFullBlock(); 47 fullBlock = genFullBlock();
48 fullBlockWithChain = genFullBlockWithChain(); 48 fullBlockWithChain = genFullBlockWithChain();
49 } 49 }
50 50
51 var tests = [ 51 var tests = [
52 52
53 (Isolate isolate) => 53 (Isolate isolate) =>
54 isolate.rootLib.load().then((Library lib) { 54 isolate.rootLib.load().then((Library lib) {
55 ServiceObject field = lib.variables.singleWhere((v) => v.name == 'cleanBlock '); 55 ServiceMap field = lib.variables.singleWhere((v) => v.name == 'cleanBlock');
56 return field['value'].load().then((Instance block) { 56 return field['value'].load().then((Instance block) {
57 expect(block.isClosure, isTrue); 57 expect(block.isClosure, isTrue);
58 expect(block.closureCtxt.isContext, isTrue); 58 expect(block.closureCtxt.isContext, isTrue);
59 expect(block.closureCtxt.length, equals(0)); 59 expect(block.closureCtxt.length, equals(0));
60 return block.closureCtxt.load().then((Context ctxt) { 60 return block.closureCtxt.load().then((Context ctxt) {
61 expect(ctxt.parentContext.isNull, isTrue); 61 expect(ctxt.parentContext.isNull, isTrue);
62 }); 62 });
63 }); 63 });
64 }), 64 }),
65 65
66 (Isolate isolate) => 66 (Isolate isolate) =>
67 isolate.rootLib.load().then((Library lib) { 67 isolate.rootLib.load().then((Library lib) {
68 ServiceObject field = lib.variables.singleWhere((v) => v.name == 'copyingBlo ck'); 68 ServiceMap field = lib.variables.singleWhere((v) => v.name == 'copyingBlock' );
69 return field['value'].load().then((Instance block) { 69 return field['value'].load().then((Instance block) {
70 expect(block.isClosure, isTrue); 70 expect(block.isClosure, isTrue);
71 expect(block.closureCtxt.isContext, isTrue); 71 expect(block.closureCtxt.isContext, isTrue);
72 expect(block.closureCtxt.length, equals(1)); 72 expect(block.closureCtxt.length, equals(1));
73 return block.closureCtxt.load().then((Context ctxt) { 73 return block.closureCtxt.load().then((Context ctxt) {
74 expect(ctxt.variables.single['value'].isString, isTrue); 74 expect(ctxt.variables.single['value'].isString, isTrue);
75 expect(ctxt.variables.single['value'].valueAsString, equals('"I could be copied into the block"')); 75 expect(ctxt.variables.single['value'].valueAsString, equals('"I could be copied into the block"'));
76 expect(block.closureCtxt.parentContext.isNull, isTrue); 76 expect(block.closureCtxt.parentContext.isNull, isTrue);
77 }); 77 });
78 }); 78 });
79 }), 79 }),
80 80
81 (Isolate isolate) => 81 (Isolate isolate) =>
82 isolate.rootLib.load().then((Library lib) { 82 isolate.rootLib.load().then((Library lib) {
83 ServiceObject field = lib.variables.singleWhere((v) => v.name == 'fullBlock' ); 83 ServiceMap field = lib.variables.singleWhere((v) => v.name == 'fullBlock');
84 return field['value'].load().then((Instance block) { 84 return field['value'].load().then((Instance block) {
85 expect(block.isClosure, isTrue); 85 expect(block.isClosure, isTrue);
86 expect(block.closureCtxt.isContext, isTrue); 86 expect(block.closureCtxt.isContext, isTrue);
87 expect(block.closureCtxt.length, equals(1)); 87 expect(block.closureCtxt.length, equals(1));
88 return block.closureCtxt.load().then((ctxt) { 88 return block.closureCtxt.load().then((ctxt) {
89 expect(ctxt.variables.single['value'].isInt, isTrue); 89 expect(ctxt.variables.single['value'].isInt, isTrue);
90 expect(ctxt.variables.single['value'].valueAsString, equals('43')); 90 expect(ctxt.variables.single['value'].valueAsString, equals('43'));
91 expect(ctxt.parentContext.isNull, isTrue); 91 expect(ctxt.parentContext.isNull, isTrue);
92 }); 92 });
93 }); 93 });
94 }), 94 }),
95 95
96 (Isolate isolate) => 96 (Isolate isolate) =>
97 isolate.rootLib.load().then((Library lib) { 97 isolate.rootLib.load().then((Library lib) {
98 ServiceObject field = lib.variables.singleWhere((v) => v.name == 'fullBlockW ithChain'); 98 ServiceMap field = lib.variables.singleWhere((v) => v.name == 'fullBlockWith Chain');
99 return field['value'].load().then((Instance block) { 99 return field['value'].load().then((Instance block) {
100 expect(block.isClosure, isTrue); 100 expect(block.isClosure, isTrue);
101 expect(block.closureCtxt.isContext, isTrue); 101 expect(block.closureCtxt.isContext, isTrue);
102 expect(block.closureCtxt.length, equals(1)); 102 expect(block.closureCtxt.length, equals(1));
103 return block.closureCtxt.load().then((Context ctxt) { 103 return block.closureCtxt.load().then((Context ctxt) {
104 expect(ctxt.variables.single['value'].isInt, isTrue); 104 expect(ctxt.variables.single['value'].isInt, isTrue);
105 expect(ctxt.variables.single['value'].valueAsString, equals('4201')); 105 expect(ctxt.variables.single['value'].valueAsString, equals('4201'));
106 expect(ctxt.parentContext.isContext, isTrue); 106 expect(ctxt.parentContext.isContext, isTrue);
107 expect(ctxt.parentContext.length, equals(1)); 107 expect(ctxt.parentContext.length, equals(1));
108 return ctxt.parentContext.load().then((Context outerCtxt) { 108 return ctxt.parentContext.load().then((Context outerCtxt) {
109 expect(outerCtxt.variables.single['value'].isInt, isTrue); 109 expect(outerCtxt.variables.single['value'].isInt, isTrue);
110 expect(outerCtxt.variables.single['value'].valueAsString, equals('421' )); 110 expect(outerCtxt.variables.single['value'].valueAsString, equals('421' ));
111 expect(outerCtxt.parentContext.isNull, isTrue); 111 expect(outerCtxt.parentContext.isNull, isTrue);
112 }); 112 });
113 }); 113 });
114 }); 114 });
115 }), 115 }),
116 116
117 ]; 117 ];
118 118
119 main(args) => runIsolateTests(args, tests, testeeBefore: script); 119 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/observatory/lib/src/service/object.dart ('k') | runtime/bin/vmservice/vmservice.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698