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

Unified Diff: test/debugger/test-api.js

Issue 2566093002: [debug-wrapper] migrate some scope related tests (Closed)
Patch Set: address comments Created 4 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 | « test/debugger/debugger.status ('k') | test/mjsunit/bugs/harmony/debug-blockscopes.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/debugger/test-api.js
diff --git a/test/debugger/test-api.js b/test/debugger/test-api.js
index 1eabf5d228162a242e035f681623d610377e5732..2fe16c0a0fa9256555341bed40ce23a960ec9090 100644
--- a/test/debugger/test-api.js
+++ b/test/debugger/test-api.js
@@ -450,8 +450,10 @@ class DebugWrapper {
if (found == null) return { isUndefined : () => true };
const val = { value : () => found.value.value };
+ // Not undefined in the sense that we did find a property, even though
+ // the value can be 'undefined'.
return { value : () => val,
- isUndefined : () => found.value.type == "undefined"
+ isUndefined : () => false,
};
}
@@ -463,7 +465,30 @@ class DebugWrapper {
const scope = this.propertiesToObject(serialized_scope);
return { value : () => scope,
property : (prop) =>
- this.execStateScopeObjectProperty(serialized_scope, prop)
+ this.execStateScopeObjectProperty(serialized_scope, prop),
+ properties : () => serialized_scope.map(elem => elem.value),
+ propertyNames : () => serialized_scope.map(elem => elem.name)
+ };
+ }
+
+ execStateScopeDetails(scope) {
+ var start_position;
+ var end_position
+ const start = scope.startLocation;
+ const end = scope.endLocation;
+ if (start) {
+ start_position = %ScriptLocationFromLine2(
+ parseInt(start.scriptId), start.lineNumber, start.columnNumber, 0)
+ .position;
+ }
+ if (end) {
+ end_position = %ScriptLocationFromLine2(
+ parseInt(end.scriptId), end.lineNumber, end.columnNumber, 0)
+ .position;
+ }
+ return { name : () => scope.name,
+ startPosition : () => start_position,
+ endPosition : () => end_position
};
}
@@ -486,10 +511,13 @@ class DebugWrapper {
execStateScope(frame, scope_index) {
const scope = frame.scopeChain[scope_index];
return { scopeType : () => this.execStateScopeType(scope.type),
+ scopeIndex : () => scope_index,
+ frameIndex : () => frame.callFrameId,
scopeObject : () => this.execStateScopeObject(scope.object),
setVariableValue :
(name, value) => this.setVariableValue(frame, scope_index,
- name, value)
+ name, value),
+ details : () => this.execStateScopeDetails(scope)
};
}
@@ -659,6 +687,14 @@ class DebugWrapper {
return this.reconstructRemoteObject(result);
}
+ frameReceiver(frame) {
+ return this.reconstructRemoteObject(frame.this);
+ }
+
+ frameReturnValue(frame) {
+ return this.reconstructRemoteObject(frame.returnValue);
+ }
+
execStateFrameRestart(frame) {
const frameid = frame.callFrameId;
const {msgid, msg} = this.createMessage(
@@ -681,11 +717,12 @@ class DebugWrapper {
scopes.push(this.execStateScope(frame, i));
}
return scopes;
- };
+ }
return { sourceColumn : () => column,
sourceLine : () => line + 1,
sourceLineText : () => loc.sourceText,
+ sourcePosition : () => loc.position,
evaluate : (expr) => this.evaluateOnCallFrame(frame, expr),
functionName : () => frame.functionName,
func : () => func,
@@ -693,14 +730,25 @@ class DebugWrapper {
localCount : () => this.execStateFrameLocalCount(frame),
localName : (ix) => this.execStateFrameLocalName(frame, ix),
localValue: (ix) => this.execStateFrameLocalValue(frame, ix),
- receiver : () => this.evaluateOnCallFrame(frame, "this"),
+ receiver : () => this.frameReceiver(frame),
restart : () => this.execStateFrameRestart(frame),
+ returnValue : () => this.frameReturnValue(frame),
scopeCount : () => frame.scopeChain.length,
scope : (index) => this.execStateScope(frame, index),
allScopes : allScopes.bind(this)
};
}
+ execStateEvaluateGlobal(expr) {
+ const {msgid, msg} = this.createMessage(
+ "Runtime.evaluate", { expression : expr });
+ this.sendMessage(msg);
+ const reply = this.takeReplyChecked(msgid);
+
+ const result = reply.result.result;
+ return this.reconstructRemoteObject(result);
+ }
+
eventDataException(params) {
switch (params.data.type) {
case "string": {
@@ -776,6 +824,8 @@ class DebugWrapper {
// TODO(jgruber): Arguments as needed.
let execState = { frames : params.callFrames,
prepareStep : this.execStatePrepareStep.bind(this),
+ evaluateGlobal :
+ (expr) => this.execStateEvaluateGlobal(expr),
frame : (index) => this.execStateFrame(
index ? params.callFrames[index]
: params.callFrames[0]),
« no previous file with comments | « test/debugger/debugger.status ('k') | test/mjsunit/bugs/harmony/debug-blockscopes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698