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

Side by Side Diff: runtime/observatory/tests/service/contexts_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
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 inbound_references_test; 6 library inbound_references_test;
7 7
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void script() { 44 void script() {
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.rootLibrary.load().then((Library lib) {
55 Field field = lib.variables.singleWhere((v) => v.name == 'cleanBlock'); 55 Field 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.rootLibrary.load().then((Library lib) {
68 Field field = lib.variables.singleWhere((v) => v.name == 'copyingBlock'); 68 Field 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(ctxt.parentContext.isContext, isTrue); 76 expect(ctxt.parentContext.isContext, isTrue);
77 expect(ctxt.parentContext.length, equals(0)); 77 expect(ctxt.parentContext.length, equals(0));
78 return ctxt.parentContext.load().then((Context outerCtxt) { 78 return ctxt.parentContext.load().then((Context outerCtxt) {
79 expect(outerCtxt.parentContext.isNull, isTrue); 79 expect(outerCtxt.parentContext.isNull, isTrue);
80 }); 80 });
81 }); 81 });
82 }); 82 });
83 }), 83 }),
84 84
85 (Isolate isolate) => 85 (Isolate isolate) =>
86 isolate.rootLib.load().then((Library lib) { 86 isolate.rootLibrary.load().then((Library lib) {
87 Field field = lib.variables.singleWhere((v) => v.name == 'fullBlock'); 87 Field field = lib.variables.singleWhere((v) => v.name == 'fullBlock');
88 return field.value.load().then((Instance block) { 88 return field.value.load().then((Instance block) {
89 expect(block.isClosure, isTrue); 89 expect(block.isClosure, isTrue);
90 expect(block.closureCtxt.isContext, isTrue); 90 expect(block.closureCtxt.isContext, isTrue);
91 expect(block.closureCtxt.length, equals(1)); 91 expect(block.closureCtxt.length, equals(1));
92 return block.closureCtxt.load().then((ctxt) { 92 return block.closureCtxt.load().then((ctxt) {
93 expect(ctxt.variables.single['value'].isInt, isTrue); 93 expect(ctxt.variables.single['value'].isInt, isTrue);
94 expect(ctxt.variables.single['value'].valueAsString, equals('43')); 94 expect(ctxt.variables.single['value'].valueAsString, equals('43'));
95 expect(ctxt.parentContext.isContext, isTrue); 95 expect(ctxt.parentContext.isContext, isTrue);
96 expect(ctxt.parentContext.length, equals(0)); 96 expect(ctxt.parentContext.length, equals(0));
97 return ctxt.parentContext.load().then((Context outerCtxt) { 97 return ctxt.parentContext.load().then((Context outerCtxt) {
98 expect(outerCtxt.parentContext.isNull, isTrue); 98 expect(outerCtxt.parentContext.isNull, isTrue);
99 }); 99 });
100 }); 100 });
101 }); 101 });
102 }), 102 }),
103 103
104 (Isolate isolate) => 104 (Isolate isolate) =>
105 isolate.rootLib.load().then((Library lib) { 105 isolate.rootLibrary.load().then((Library lib) {
106 Field field = lib.variables.singleWhere((v) => v.name == 'fullBlockWithChain '); 106 Field field = lib.variables.singleWhere((v) => v.name == 'fullBlockWithChain ');
107 return field.value.load().then((Instance block) { 107 return field.value.load().then((Instance block) {
108 expect(block.isClosure, isTrue); 108 expect(block.isClosure, isTrue);
109 expect(block.closureCtxt.isContext, isTrue); 109 expect(block.closureCtxt.isContext, isTrue);
110 expect(block.closureCtxt.length, equals(1)); 110 expect(block.closureCtxt.length, equals(1));
111 return block.closureCtxt.load().then((Context ctxt) { 111 return block.closureCtxt.load().then((Context ctxt) {
112 expect(ctxt.variables.single['value'].isInt, isTrue); 112 expect(ctxt.variables.single['value'].isInt, isTrue);
113 expect(ctxt.variables.single['value'].valueAsString, equals('4201')); 113 expect(ctxt.variables.single['value'].valueAsString, equals('4201'));
114 expect(ctxt.parentContext.isContext, isTrue); 114 expect(ctxt.parentContext.isContext, isTrue);
115 expect(ctxt.parentContext.length, equals(1)); 115 expect(ctxt.parentContext.length, equals(1));
116 return ctxt.parentContext.load().then((Context outerCtxt) { 116 return ctxt.parentContext.load().then((Context outerCtxt) {
117 expect(outerCtxt.variables.single['value'].isInt, isTrue); 117 expect(outerCtxt.variables.single['value'].isInt, isTrue);
118 expect(outerCtxt.variables.single['value'].valueAsString, equals('421' )); 118 expect(outerCtxt.variables.single['value'].valueAsString, equals('421' ));
119 expect(outerCtxt.parentContext.isContext, isTrue); 119 expect(outerCtxt.parentContext.isContext, isTrue);
120 expect(outerCtxt.parentContext.length, equals(0)); 120 expect(outerCtxt.parentContext.length, equals(0));
121 return outerCtxt.parentContext.load().then((Context outerCtxt2) { 121 return outerCtxt.parentContext.load().then((Context outerCtxt2) {
122 expect(outerCtxt2.parentContext.isNull, isTrue); 122 expect(outerCtxt2.parentContext.isNull, isTrue);
123 }); 123 });
124 }); 124 });
125 }); 125 });
126 }); 126 });
127 }), 127 }),
128 128
129 ]; 129 ];
130 130
131 main(args) => runIsolateTests(args, tests, testeeBefore: script); 131 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/code_test.dart ('k') | runtime/observatory/tests/service/coverage_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698