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

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

Issue 2447073007: [debugger] Various break-related functionality in test wrapper (Closed)
Patch Set: Move DebugEvent to DebugWrapper to preserve old API Created 4 years, 2 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
« no previous file with comments | « src/runtime/runtime-function.cc ('k') | test/debugger/debugger/debug-step-2.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/debugger/debugger/debug-step.js
diff --git a/test/debugger/debugger/debug-step.js b/test/debugger/debugger/debug-step.js
new file mode 100644
index 0000000000000000000000000000000000000000..3560efd1df1c50ac5d1ef0bffa7b667c142229a1
--- /dev/null
+++ b/test/debugger/debugger/debug-step.js
@@ -0,0 +1,43 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// 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();
+
+// Simple debug event handler which performs 100 steps and then retrieves
+// the resulting value of "i" in f().
+
+function listener(event, exec_state, event_data, data) {
+ if (event == Debug.DebugEvent.Break) {
+ if (step_count > 0) {
+ Debug.stepInto();
+ step_count--;
+ } else {
+ const frameid = exec_state.frames[0].callFrameId;
+ result = Debug.evaluate(frameid, "i").value;
+ }
+ }
+};
+
+// Add the debug event listener.
+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.
+ }
+};
+
+// 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;
+
+f();
+
+assertEquals(33, result);
« no previous file with comments | « src/runtime/runtime-function.cc ('k') | test/debugger/debugger/debug-step-2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698