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

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

Issue 2361183002: Respect setLibraryDebuggable (Closed)
Patch Set: Respect setLibraryDebuggable Created 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/tests/service/service_test_common.dart
diff --git a/runtime/observatory/tests/service/service_test_common.dart b/runtime/observatory/tests/service/service_test_common.dart
index 9cf11cdba44ebb9d4709beb83e4cab3e43944e66..935d42602d60ee92c86dbad35526792738ef18fa 100644
--- a/runtime/observatory/tests/service/service_test_common.dart
+++ b/runtime/observatory/tests/service/service_test_common.dart
@@ -228,7 +228,7 @@ IsolateTest stoppedAtLine(int line) {
Script script = await top.location.script.load();
int actualLine = script.tokenToLine(top.location.tokenPos);
if (actualLine != line) {
- var sb = new StringBuffer();
+ StringBuffer sb = new StringBuffer();
sb.write("Expected to be at line $line but actually at line $actualLine");
sb.write("\nFull stack trace:\n");
for (Frame f in stack['frames']) {
@@ -242,6 +242,41 @@ IsolateTest stoppedAtLine(int line) {
}
+IsolateTest stoppedInFunction(String functionName, {bool contains: false}) {
+ return (Isolate isolate) async {
+ print("Checking we are in function: $functionName");
+
+ ServiceMap stack = await isolate.getStack();
+ expect(stack.type, equals('Stack'));
+
+ List<Frame> frames = stack['frames'];
+ expect(frames.length, greaterThanOrEqualTo(1));
+
+ Frame topFrame = stack['frames'][0];
+ ServiceFunction function = await topFrame.function.load();
+ final bool matches =
+ contains ? function.name.contains(functionName) :
+ function.name == functionName;
+ if (!matches) {
+ StringBuffer sb = new StringBuffer();
+ sb.write("Expected to be in function $functionName but "
+ "actually in function ${function.name}");
+ sb.write("\nFull stack trace:\n");
+ for (Frame f in stack['frames']) {
+ await f.function.load();
+ await (f.function.dartOwner as ServiceObject).load();
+ String name = f.function.name;
+ String ownerName = (f.function.dartOwner as ServiceObject).name;
+ sb.write(" $f [$name] [$ownerName]\n");
+ }
+ throw sb.toString();
+ } else {
+ print('Program is stopped in function: $functionName');
+ }
+ };
+}
+
+
Future<Isolate> resumeIsolate(Isolate isolate) {
Completer completer = new Completer();
isolate.vm.getEventStream(VM.kDebugStream).then((stream) {
@@ -292,6 +327,12 @@ Future<Isolate> stepInto(Isolate isolate) async {
return hasStoppedAtBreakpoint(isolate);
}
+Future<Isolate> stepOut(Isolate isolate) async {
+ await isolate.stepOut();
+ return hasStoppedAtBreakpoint(isolate);
+}
+
+
Future<Class> getClassFromRootLib(Isolate isolate, String className) async {
Library rootLib = await isolate.rootLibrary.load();
for (var i = 0; i < rootLib.classes.length; i++) {

Powered by Google App Engine
This is Rietveld 408576698