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

Unified Diff: tests/standalone/debugger/debug_lib.dart

Issue 11645025: Address Siva's and Mads' review request in debugger test (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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
« no previous file with comments | « tests/standalone/debugger/basic_debugger_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/debugger/debug_lib.dart
===================================================================
--- tests/standalone/debugger/debug_lib.dart (revision 16335)
+++ tests/standalone/debugger/debug_lib.dart (working copy)
@@ -42,13 +42,15 @@
msg = buffer;
buffer = null;
} else {
+ assert(msgLen < buffer.length);
msg = buffer.substring(0, msgLen);
buffer = buffer.substring(msgLen);
}
return msg;
}
- // Skip past a JSON object value.
+ // Returns the character length of the newxt json message in the
+ // buffer, or 0 if there is only a partial message in the buffer.
// The object value must start with '{' and continues to the
// matching '}'. No attempt is made to otherwise validate the contents
// as JSON. If it is invalid, a later JSON.parse() will fail.
@@ -76,14 +78,14 @@
index = skipWhitespace(index);
// Bail out if the first non-whitespace character isn't '{'.
if (index == buffer.length || buffer[index] != '{') return 0;
- int nexting = 0;
+ int nesting = 0;
while (index < buffer.length) {
String char = buffer[index++];
if (char == '{') {
- nexting++;
+ nesting++;
} else if (char == '}') {
- nexting--;
- if (nexting == 0) return index;
+ nesting--;
+ if (nesting == 0) return index;
} else if (char == '"') {
// Strings can contain braces. Skip their content.
index = skipString(index);
@@ -114,7 +116,7 @@
}
property = property.substring(0, bracketPos);
}
- if (node is Map) {
+ if (node is Map) {
node = node[property];
} else {
return null;
@@ -162,7 +164,9 @@
void match(Debugger debugger) {
var msg = debugger.currentMessage;
- if (!matchMaps(template, msg)) debugger.error("message does not match $template");
+ if (!matchMaps(template, msg)) {
+ debugger.error("message does not match $template");
+ }
var name = getJsonValue(msg, "params:callFrames[0]:functionName");
if (name == "main") {
// Extract script url of debugged script.
@@ -198,7 +202,8 @@
List frames = getJsonValue(msg, "params:callFrames");
assert(frames != null);
if (frames.length < functionNames.length) {
- debugger.error("stack trace not long enough to match ${functionNames.length} frames");
+ debugger.error("stack trace not long enough "
+ "to match ${functionNames.length} frames");
return;
}
for (int i = 0; i < functionNames.length; i++) {
@@ -239,7 +244,8 @@
}
Map makeMsg(int cmdId, int isolateId) {
template["id"] = cmdId;
- if ((template["params"] != null) && (template["params"]["isolateId"] != null)) {
+ if ((template["params"] != null)
+ && (template["params"]["isolateId"] != null)) {
template["params"]["isolateId"] = isolateId;
}
return template;
@@ -348,6 +354,9 @@
} else if (msg["params"]["reason"] == "shutdown") {
print("Debuggee isolate id ${msg["params"]["id"]} shut down.");
shutdownEventSeen = true;
+ if (script.currentEntry != null) {
+ error("Premature isolate shutdown event seen.");
+ }
}
return true;
} else if (msg["event"] == "breakpointResolved") {
@@ -507,6 +516,8 @@
Process.start(options.executable, targetOpts).then((Process process) {
print("Debug target process started");
process.stdin.close();
+ process.stdout.onData = process.stdout.read;
+ process.stderr.onData = process.stderr.read;
process.onExit = (int exitCode) {
print("Debug target process exited with exit code $exitCode");
};
« no previous file with comments | « tests/standalone/debugger/basic_debugger_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698