Commit 0398e5d5 authored by yangguo's avatar yangguo Committed by Commit bot

[debug] remove debug command processor from scope tests.

BUG=v8:5510
R=jgruber@chromium.org

Review-Url: https://codereview.chromium.org/2536573002
Cr-Commit-Position: refs/heads/master@{#41311}
parent 6c057947
......@@ -93,31 +93,6 @@ function CheckScopeChain(scopes, exec_state) {
assertPropertiesEqual(this, scope.scopeObject().value());
}
}
// Get the debug command processor.
var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
// Send a scopes request and check the result.
var json;
var request_json = '{"seq":0,"type":"request","command":"scopes"}';
var response_json = dcp.processDebugJSONRequest(request_json);
var response = JSON.parse(response_json);
assertEquals(scopes.length, response.body.scopes.length);
for (var i = 0; i < scopes.length; i++) {
assertEquals(i, response.body.scopes[i].index);
assertEquals(scopes[i], response.body.scopes[i].type);
if (scopes[i] == debug.ScopeType.Local ||
scopes[i] == debug.ScopeType.Closure) {
assertTrue(response.body.scopes[i].object.ref < 0);
} else {
assertTrue(response.body.scopes[i].object.ref >= 0);
}
var found = false;
for (var j = 0; j < response.refs.length && !found; j++) {
found = response.refs[j].handle == response.body.scopes[i].object.ref;
}
assertTrue(found, "Scope object " + response.body.scopes[i].object.ref + " not found");
}
}
// Check that the content of the scope is as expected. For functions just check
......@@ -130,11 +105,13 @@ function CheckScopeContent(content, number, exec_state) {
if (property_mirror.isUndefined()) {
print('property ' + p + ' not found in scope');
}
assertFalse(property_mirror.isUndefined(), 'property ' + p + ' not found in scope');
assertFalse(property_mirror.isUndefined(),
'property ' + p + ' not found in scope');
if (typeof(content[p]) === 'function') {
assertTrue(property_mirror.value().isFunction());
} else {
assertEquals(content[p], property_mirror.value().value(), 'property ' + p + ' has unexpected value');
assertEquals(content[p], property_mirror.value().value(),
'property ' + p + ' has unexpected value');
}
count++;
}
......@@ -158,30 +135,6 @@ function CheckScopeContent(content, number, exec_state) {
}
}
assertEquals(count, scope_size);
// Get the debug command processor.
var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
// Send a scope request for information on a single scope and check the
// result.
var request_json = '{"seq":0,"type":"request","command":"scope","arguments":{"number":';
request_json += scope.scopeIndex();
request_json += '}}';
var response_json = dcp.processDebugJSONRequest(request_json);
var response = JSON.parse(response_json);
assertEquals(scope.scopeType(), response.body.type);
assertEquals(number, response.body.index);
if (scope.scopeType() == debug.ScopeType.Local ||
scope.scopeType() == debug.ScopeType.Closure) {
assertTrue(response.body.object.ref < 0);
} else {
assertTrue(response.body.object.ref >= 0);
}
var found = false;
for (var i = 0; i < response.refs.length && !found; i++) {
found = response.refs[i].handle == response.body.object.ref;
}
assertTrue(found, "Scope object " + response.body.object.ref + " not found");
}
......
This diff is collapsed.
......@@ -95,32 +95,6 @@ function CheckScopeChain(scopes, exec_state) {
assertPropertiesEqual(global_object, scope.scopeObject().value());
}
}
// Get the debug command processor.
var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
// Send a scopes request and check the result.
var json;
var request_json = '{"seq":0,"type":"request","command":"scopes"}';
var response_json = dcp.processDebugJSONRequest(request_json);
var response = JSON.parse(response_json);
assertEquals(scopes.length, response.body.scopes.length);
for (var i = 0; i < scopes.length; i++) {
assertEquals(i, response.body.scopes[i].index);
assertEquals(scopes[i], response.body.scopes[i].type);
if (scopes[i] == debug.ScopeType.Local ||
scopes[i] == debug.ScopeType.Script ||
scopes[i] == debug.ScopeType.Closure) {
assertTrue(response.body.scopes[i].object.ref < 0);
} else {
assertTrue(response.body.scopes[i].object.ref >= 0);
}
var found = false;
for (var j = 0; j < response.refs.length && !found; j++) {
found = response.refs[j].handle == response.body.scopes[i].object.ref;
}
assertTrue(found, "Scope object " + response.body.scopes[i].object.ref + " not found");
}
}
// Check that the content of the scope is as expected. For functions just check
......@@ -133,11 +107,13 @@ function CheckScopeContent(content, number, exec_state) {
if (property_mirror.isUndefined()) {
print('property ' + p + ' not found in scope');
}
assertFalse(property_mirror.isUndefined(), 'property ' + p + ' not found in scope');
assertFalse(property_mirror.isUndefined(),
'property ' + p + ' not found in scope');
if (typeof(content[p]) === 'function') {
assertTrue(property_mirror.value().isFunction());
} else {
assertEquals(content[p], property_mirror.value().value(), 'property ' + p + ' has unexpected value');
assertEquals(content[p], property_mirror.value().value(),
'property ' + p + ' has unexpected value');
}
count++;
}
......@@ -159,30 +135,6 @@ function CheckScopeContent(content, number, exec_state) {
}
}
assertEquals(count, scope_size);
// Get the debug command processor.
var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
// Send a scope request for information on a single scope and check the
// result.
var request_json = '{"seq":0,"type":"request","command":"scope","arguments":{"number":';
request_json += scope.scopeIndex();
request_json += '}}';
var response_json = dcp.processDebugJSONRequest(request_json);
var response = JSON.parse(response_json);
assertEquals(scope.scopeType(), response.body.type);
assertEquals(number, response.body.index);
if (scope.scopeType() == debug.ScopeType.Local ||
scope.scopeType() == debug.ScopeType.Closure) {
assertTrue(response.body.object.ref < 0);
} else {
assertTrue(response.body.object.ref >= 0);
}
var found = false;
for (var i = 0; i < response.refs.length && !found; i++) {
found = response.refs[i].handle == response.body.object.ref;
}
assertTrue(found, "Scope object " + response.body.object.ref + " not found");
}
......
......@@ -83,32 +83,6 @@ function CheckScopeChain(scopes, exec_state) {
}
}
CheckFastAllScopes(scopes, exec_state);
// Get the debug command processor.
var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
// Send a scopes request and check the result.
var json;
var request_json = '{"seq":0,"type":"request","command":"scopes"}';
var response_json = dcp.processDebugJSONRequest(request_json);
var response = JSON.parse(response_json);
assertEquals(scopes.length, response.body.scopes.length);
for (var i = 0; i < scopes.length; i++) {
assertEquals(i, response.body.scopes[i].index);
assertEquals(scopes[i], response.body.scopes[i].type);
if (scopes[i] == debug.ScopeType.Local ||
scopes[i] == debug.ScopeType.Script ||
scopes[i] == debug.ScopeType.Closure) {
assertTrue(response.body.scopes[i].object.ref < 0);
} else {
assertTrue(response.body.scopes[i].object.ref >= 0);
}
var found = false;
for (var j = 0; j < response.refs.length && !found; j++) {
found = response.refs[j].handle == response.body.scopes[i].object.ref;
}
assertTrue(found, "Scope object " + response.body.scopes[i].object.ref + " not found");
}
}
// Check that the content of the scope is as expected. For functions just check
......@@ -118,11 +92,13 @@ function CheckScopeContent(content, number, exec_state) {
var count = 0;
for (var p in content) {
var property_mirror = scope.scopeObject().property(p);
assertFalse(property_mirror.isUndefined(), 'property ' + p + ' not found in scope');
assertFalse(property_mirror.isUndefined(),
'property ' + p + ' not found in scope');
if (typeof(content[p]) === 'function') {
assertTrue(property_mirror.value().isFunction());
} else {
assertEquals(content[p], property_mirror.value().value(), 'property ' + p + ' has unexpected value');
assertEquals(content[p], property_mirror.value().value(),
'property ' + p + ' has unexpected value');
}
count++;
}
......@@ -146,31 +122,6 @@ function CheckScopeContent(content, number, exec_state) {
}
}
assertEquals(count, scope_size);
// Get the debug command processor.
var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
// Send a scope request for information on a single scope and check the
// result.
var request_json = '{"seq":0,"type":"request","command":"scope","arguments":{"number":';
request_json += scope.scopeIndex();
request_json += '}}';
var response_json = dcp.processDebugJSONRequest(request_json);
var response = JSON.parse(response_json);
assertEquals(scope.scopeType(), response.body.type);
assertEquals(number, response.body.index);
if (scope.scopeType() == debug.ScopeType.Local ||
scope.scopeType() == debug.ScopeType.Script ||
scope.scopeType() == debug.ScopeType.Closure) {
assertTrue(response.body.object.ref < 0);
} else {
assertTrue(response.body.object.ref >= 0);
}
var found = false;
for (var i = 0; i < response.refs.length && !found; i++) {
found = response.refs[i].handle == response.body.object.ref;
}
assertTrue(found, "Scope object " + response.body.object.ref + " not found");
}
......@@ -323,7 +274,8 @@ RunTest("The full monty",
CheckScopeContent({x:14}, 2, exec_state);
CheckScopeContent({j:13}, 3, exec_state);
CheckScopeContent({a:1,b:2,x:9,y:10,i:11,j:12}, 4, exec_state);
CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6,f:function(){}}, 5, exec_state);
CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6,f:function(){}}, 5,
exec_state);
},
function (result) { result() });
......
......@@ -515,33 +515,6 @@ function CheckScopeChain(scopes, exec_state) {
}
}
CheckFastAllScopes(scopes, exec_state);
// Get the debug command processor.
var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
// Send a scopes request and check the result.
var json;
var request_json = '{"seq":0,"type":"request","command":"scopes"}';
var response_json = dcp.processDebugJSONRequest(request_json);
var response = JSON.parse(response_json);
assertEquals(scopes.length, response.body.scopes.length);
for (var i = 0; i < scopes.length; i++) {
var scopeRef = response.body.scopes[i].object.ref;
assertEquals(i, response.body.scopes[i].index);
assertEquals(scopes[i], response.body.scopes[i].type);
if (scopes[i] == debug.ScopeType.Local ||
scopes[i] == debug.ScopeType.Script ||
scopes[i] == debug.ScopeType.Closure) {
assertTrue(response.body.scopes[i].object.ref < 0);
} else {
assertTrue(response.body.scopes[i].object.ref >= 0);
}
var found = false;
for (var j = 0; j < response.refs.length && !found; j++) {
found = response.refs[j].handle == response.body.scopes[i].object.ref;
}
assertTrue(found, `Scope object ${scopeRef} not found`);
}
}
// Check that the content of the scope is as expected. For functions just check
......@@ -581,34 +554,4 @@ function CheckScopeContent(content, number, exec_state) {
}
}
assertEquals(count, scope_size);
// Get the debug command processor.
var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
// Send a scope request for information on a single scope and check the
// result.
var request_json = `{
"seq": 0,
"type": "request",
"command": "scope",
"arguments": {
"number": `;
request_json += scope.scopeIndex();
request_json += '}}';
var response_json = dcp.processDebugJSONRequest(request_json);
var response = JSON.parse(response_json);
assertEquals(scope.scopeType(), response.body.type);
assertEquals(number, response.body.index);
if (scope.scopeType() == debug.ScopeType.Local ||
scope.scopeType() == debug.ScopeType.Script ||
scope.scopeType() == debug.ScopeType.Closure) {
assertTrue(response.body.object.ref < 0);
} else {
assertTrue(response.body.object.ref >= 0);
}
var found = false;
for (var i = 0; i < response.refs.length && !found; i++) {
found = response.refs[i].handle == response.body.object.ref;
}
assertTrue(found, "Scope object " + response.body.object.ref + " not found");
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment