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

Unified Diff: test/debugger/debug/debug-step.js

Issue 2497973002: [debug-wrapper] Further extend the debug wrapper (Closed)
Patch Set: Address comments Created 4 years, 1 month 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: test/debugger/debug/debug-step.js
diff --git a/test/debugger/debug/debug-step.js b/test/debugger/debug/debug-step.js
index 3560efd1df1c50ac5d1ef0bffa7b667c142229a1..369e8a645cdc2e57a9291699abdbe883e3437cbd 100644
--- a/test/debugger/debug/debug-step.js
+++ b/test/debugger/debug/debug-step.js
@@ -2,20 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-Debug = new DebugWrapper();
-Debug.enable();
+Debug = debug.Debug
-// Simple debug event handler which performs 100 steps and then retrieves
-// the resulting value of "i" in f().
+// Simple debug event handler which first time hit will perform 1000 steps and
+// second time hit will evaluate and store the value of "i". If requires that
+// the global property "state" is initially zero.
+
+var bp1, bp2;
function listener(event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.Break) {
if (step_count > 0) {
- Debug.stepInto();
+ exec_state.prepareStep(Debug.StepAction.StepIn);
step_count--;
} else {
- const frameid = exec_state.frames[0].callFrameId;
- result = Debug.evaluate(frameid, "i").value;
+ result = exec_state.frame().evaluate("i").value();
+ // Clear the break point on line 2 if set.
+ if (bp2) {
+ Debug.clearBreakPoint(bp2);
+ }
}
}
};
@@ -25,19 +30,18 @@ Debug.setListener(listener);
// Test debug event for break point.
function f() {
- var i; // Line 1.
- for (i = 0; i < 100; i++) { // Line 2.
- x = 1; // Line 3.
+ var i; // Line 1.
+ for (i = 0; i < 1000; i++) { // Line 2.
+ x = 1; // Line 3.
}
};
// Set a breakpoint on the for statement (line 1).
-Debug.setBreakPoint(f, 1);
-
-// Check that performing 100 steps will make i 33.
-let step_count = 100;
-let result = -1;
+bp1 = Debug.setBreakPoint(f, 1);
+// Check that performing 1000 steps will make i 333.
+var step_count = 1000;
+result = -1;
f();
-
-assertEquals(33, result);
+assertEquals(333, result);
+Debug.setListener(null);
« no previous file with comments | « test/debugger/debug/debug-scripts-throw.js ('k') | test/debugger/debug/es6/debug-evaluate-arrow-function-receiver.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698