}
{
// Check literals.
for (LiteralTestCase literal : TEST_LITERALS) {
JsVariable resultVar = evaluateSync(context.getGlobalEvaluateContext(),
literal.javaScriptExpression);
JsValue resultValue = resultVar.getValue();
if (resultValue.getType() != literal.expectedType) {
throw new SmokeException("Unexpected type of '" + literal.javaScriptExpression +
"': " + resultValue.getType());
}
if (!literal.expectedDescription.equals(resultValue.getValueString())) {
throw new SmokeException("Unexpected string value of '" +
literal.javaScriptExpression + "': " + resultValue.getValueString());
}
}
}
// Do not block dispatcher thread.
stateManager.setDefaultReceiver(IGNORE_SCRIPTS_VISITOR);
List<? extends CallFrame> callFrames = context.getCallFrames();
CallFrame topFrame = callFrames.get(0);
JsScope localScope;
findScope: {
for (JsScope scope : topFrame.getVariableScopes()) {
if (scope.getType() == JsScope.Type.LOCAL) {
localScope = scope;
break findScope;
}
}
throw new SmokeException("Failed to find local scope");
}
JsVariable xVar = getVariable(localScope, "x");
if (!"1".equals(xVar.getValue().getValueString())) {
throw new SmokeException("Unexpected value of local variable");
}
JsVariable yVar = getVariable(localScope, "y");
if (!"2".equals(yVar.getValue().getValueString())) {
throw new SmokeException("Unexpected value of local variable");
}
for (CallFrame frame : callFrames) {
checkExpression(frame);