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

Unified Diff: runtime/observatory/tests/service/contexts_test.dart

Issue 1160873002: Sundry service protocol cleanups before version 1.0. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: pre commit 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/tests/service/contexts_test.dart
diff --git a/runtime/observatory/tests/service/contexts_test.dart b/runtime/observatory/tests/service/contexts_test.dart
index 6bbcacde2f3353c1de9c36cd6ab5eb3d940d9ad9..6b3e8c9c3330c3258b06c4266d0e2acb28d83fe1 100644
--- a/runtime/observatory/tests/service/contexts_test.dart
+++ b/runtime/observatory/tests/service/contexts_test.dart
@@ -53,12 +53,14 @@ var tests = [
(Isolate isolate) =>
isolate.rootLibrary.load().then((Library lib) {
Field field = lib.variables.singleWhere((v) => v.name == 'cleanBlock');
- return field.value.load().then((Instance block) {
- expect(block.isClosure, isTrue);
- expect(block.context.isContext, isTrue);
- expect(block.context.length, equals(0));
- return block.context.load().then((Context ctxt) {
- expect(ctxt.parentContext.isNull, isTrue);
+ return field.load().then((_) {
+ return field.staticValue.load().then((Instance block) {
+ expect(block.isClosure, isTrue);
+ expect(block.context.isContext, isTrue);
+ expect(block.context.length, equals(0));
+ return block.context.load().then((Context ctxt) {
+ expect(ctxt.parentContext.isNull, isTrue);
+ });
});
});
}),
@@ -66,17 +68,19 @@ var tests = [
(Isolate isolate) =>
isolate.rootLibrary.load().then((Library lib) {
Field field = lib.variables.singleWhere((v) => v.name == 'copyingBlock');
- return field.value.load().then((Instance block) {
- expect(block.isClosure, isTrue);
- expect(block.context.isContext, isTrue);
- expect(block.context.length, equals(1));
- return block.context.load().then((Context ctxt) {
- expect(ctxt.variables.single['value'].isString, isTrue);
- expect(ctxt.variables.single['value'].valueAsString, equals('I could be copied into the block'));
- expect(ctxt.parentContext.isContext, isTrue);
- expect(ctxt.parentContext.length, equals(0));
- return ctxt.parentContext.load().then((Context outerCtxt) {
- expect(outerCtxt.parentContext.isNull, isTrue);
+ return field.load().then((_) {
+ return field.staticValue.load().then((Instance block) {
+ expect(block.isClosure, isTrue);
+ expect(block.context.isContext, isTrue);
+ expect(block.context.length, equals(1));
+ return block.context.load().then((Context ctxt) {
+ expect(ctxt.variables.single['value'].isString, isTrue);
+ expect(ctxt.variables.single['value'].valueAsString, equals('I could be copied into the block'));
+ expect(ctxt.parentContext.isContext, isTrue);
+ expect(ctxt.parentContext.length, equals(0));
+ return ctxt.parentContext.load().then((Context outerCtxt) {
+ expect(outerCtxt.parentContext.isNull, isTrue);
+ });
});
});
});
@@ -85,17 +89,19 @@ var tests = [
(Isolate isolate) =>
isolate.rootLibrary.load().then((Library lib) {
Field field = lib.variables.singleWhere((v) => v.name == 'fullBlock');
- return field.value.load().then((Instance block) {
- expect(block.isClosure, isTrue);
- expect(block.context.isContext, isTrue);
- expect(block.context.length, equals(1));
- return block.context.load().then((ctxt) {
- expect(ctxt.variables.single['value'].isInt, isTrue);
- expect(ctxt.variables.single['value'].valueAsString, equals('43'));
- expect(ctxt.parentContext.isContext, isTrue);
- expect(ctxt.parentContext.length, equals(0));
- return ctxt.parentContext.load().then((Context outerCtxt) {
- expect(outerCtxt.parentContext.isNull, isTrue);
+ return field.load().then((_) {
+ return field.staticValue.load().then((Instance block) {
+ expect(block.isClosure, isTrue);
+ expect(block.context.isContext, isTrue);
+ expect(block.context.length, equals(1));
+ return block.context.load().then((ctxt) {
+ expect(ctxt.variables.single['value'].isInt, isTrue);
+ expect(ctxt.variables.single['value'].valueAsString, equals('43'));
+ expect(ctxt.parentContext.isContext, isTrue);
+ expect(ctxt.parentContext.length, equals(0));
+ return ctxt.parentContext.load().then((Context outerCtxt) {
+ expect(outerCtxt.parentContext.isNull, isTrue);
+ });
});
});
});
@@ -104,22 +110,24 @@ var tests = [
(Isolate isolate) =>
isolate.rootLibrary.load().then((Library lib) {
Field field = lib.variables.singleWhere((v) => v.name == 'fullBlockWithChain');
- return field.value.load().then((Instance block) {
- expect(block.isClosure, isTrue);
- expect(block.context.isContext, isTrue);
- expect(block.context.length, equals(1));
- return block.context.load().then((Context ctxt) {
- expect(ctxt.variables.single['value'].isInt, isTrue);
- expect(ctxt.variables.single['value'].valueAsString, equals('4201'));
- expect(ctxt.parentContext.isContext, isTrue);
- expect(ctxt.parentContext.length, equals(1));
- return ctxt.parentContext.load().then((Context outerCtxt) {
- expect(outerCtxt.variables.single['value'].isInt, isTrue);
- expect(outerCtxt.variables.single['value'].valueAsString, equals('421'));
- expect(outerCtxt.parentContext.isContext, isTrue);
- expect(outerCtxt.parentContext.length, equals(0));
- return outerCtxt.parentContext.load().then((Context outerCtxt2) {
- expect(outerCtxt2.parentContext.isNull, isTrue);
+ return field.load().then((_) {
+ return field.staticValue.load().then((Instance block) {
+ expect(block.isClosure, isTrue);
+ expect(block.context.isContext, isTrue);
+ expect(block.context.length, equals(1));
+ return block.context.load().then((Context ctxt) {
+ expect(ctxt.variables.single['value'].isInt, isTrue);
+ expect(ctxt.variables.single['value'].valueAsString, equals('4201'));
+ expect(ctxt.parentContext.isContext, isTrue);
+ expect(ctxt.parentContext.length, equals(1));
+ return ctxt.parentContext.load().then((Context outerCtxt) {
+ expect(outerCtxt.variables.single['value'].isInt, isTrue);
+ expect(outerCtxt.variables.single['value'].valueAsString, equals('421'));
+ expect(outerCtxt.parentContext.isContext, isTrue);
+ expect(outerCtxt.parentContext.length, equals(0));
+ return outerCtxt.parentContext.load().then((Context outerCtxt2) {
+ expect(outerCtxt2.parentContext.isNull, isTrue);
+ });
});
});
});

Powered by Google App Engine
This is Rietveld 408576698