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

Unified Diff: test/mjsunit/debug-script-breakpoints.js

Issue 40317: Added unique id to all scripts (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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 | « test/cctest/test-debug.cc ('k') | test/mjsunit/debug-setbreakpoint.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/debug-script-breakpoints.js
===================================================================
--- test/mjsunit/debug-script-breakpoints.js (revision 1464)
+++ test/mjsunit/debug-script-breakpoints.js (working copy)
@@ -29,8 +29,8 @@
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug
-// Set and remove a script break point.
-var sbp = Debug.setScriptBreakPoint("1", 2, 3);
+// Set and remove a script break point for a named script.
+var sbp = Debug.setScriptBreakPointByName("1", 2, 3);
assertEquals(1, Debug.scriptBreakPoints().length);
assertEquals("1", Debug.scriptBreakPoints()[0].script_name());
assertEquals(2, Debug.scriptBreakPoints()[0].line());
@@ -38,10 +38,10 @@
Debug.clearBreakPoint(sbp);
assertEquals(0, Debug.scriptBreakPoints().length);
-// Set three script break points.
-var sbp1 = Debug.setScriptBreakPoint("1", 2, 3);
-var sbp2 = Debug.setScriptBreakPoint("2", 3, 4);
-var sbp3 = Debug.setScriptBreakPoint("3", 4, 5);
+// Set three script break points for named scripts.
+var sbp1 = Debug.setScriptBreakPointByName("1", 2, 3);
+var sbp2 = Debug.setScriptBreakPointByName("2", 3, 4);
+var sbp3 = Debug.setScriptBreakPointByName("3", 4, 5);
// Check the content of the script break points.
assertEquals(3, Debug.scriptBreakPoints().length);
@@ -57,7 +57,7 @@
assertEquals(4, x.line());
assertEquals(5, x.column());
} else {
- assertUnreachable("unecpected script_data " + x.script_data());
+ assertUnreachable("unecpected script_name " + x.script_name());
}
}
@@ -69,3 +69,44 @@
assertEquals(1, Debug.scriptBreakPoints().length);
Debug.clearBreakPoint(sbp2);
assertEquals(0, Debug.scriptBreakPoints().length);
+
+// Set and remove a script break point for a script id.
+var sbp = Debug.setScriptBreakPointById(1, 2, 3);
+assertEquals(1, Debug.scriptBreakPoints().length);
+assertEquals(1, Debug.scriptBreakPoints()[0].script_id());
+assertEquals(2, Debug.scriptBreakPoints()[0].line());
+assertEquals(3, Debug.scriptBreakPoints()[0].column());
+Debug.clearBreakPoint(sbp);
+assertEquals(0, Debug.scriptBreakPoints().length);
+
+// Set three script break points for script ids.
+var sbp1 = Debug.setScriptBreakPointById(1, 2, 3);
+var sbp2 = Debug.setScriptBreakPointById(2, 3, 4);
+var sbp3 = Debug.setScriptBreakPointById(3, 4, 5);
+
+// Check the content of the script break points.
+assertEquals(3, Debug.scriptBreakPoints().length);
+for (var i = 0; i < Debug.scriptBreakPoints().length; i++) {
+ var x = Debug.scriptBreakPoints()[i];
+ if (1 == x.script_id()) {
+ assertEquals(2, x.line());
+ assertEquals(3, x.column());
+ } else if (2 == x.script_id()) {
+ assertEquals(3, x.line());
+ assertEquals(4, x.column());
+ } else if (3 == x.script_id()) {
+ assertEquals(4, x.line());
+ assertEquals(5, x.column());
+ } else {
+ assertUnreachable("unecpected script_id " + x.script_id());
+ }
+}
+
+// Remove script break points (in another order than they where added).
+assertEquals(3, Debug.scriptBreakPoints().length);
+Debug.clearBreakPoint(sbp1);
+assertEquals(2, Debug.scriptBreakPoints().length);
+Debug.clearBreakPoint(sbp3);
+assertEquals(1, Debug.scriptBreakPoints().length);
+Debug.clearBreakPoint(sbp2);
+assertEquals(0, Debug.scriptBreakPoints().length);
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/mjsunit/debug-setbreakpoint.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698