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

Unified Diff: test/cctest/test-debug.cc

Issue 2824007: Fix a bug when top level break points fall into the last function in script. (Closed)
Patch Set: Update after review Created 10 years, 6 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.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/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 7b8cffb1ed18db06b2ff379644de694b57205485..2d85a4706627d35b903e80d81170b07bf4a8f9fb 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -2028,6 +2028,51 @@ TEST(ScriptBreakPointLine) {
}
+// Test top level script break points set on lines.
+TEST(ScriptBreakPointLineTopLevel) {
+ v8::HandleScope scope;
+ DebugLocalContext env;
+ env.ExposeDebug();
+
+ v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
+ v8::Undefined());
+
+ v8::Local<v8::String> script = v8::String::New(
+ "function f() {\n"
+ " a = 1; // line 1\n"
+ "}\n"
+ "a = 2; // line 3\n");
+ v8::Local<v8::Function> f;
+ {
+ v8::HandleScope scope;
+ v8::Script::Compile(script, v8::String::New("test.html"))->Run();
+ }
+ f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+
+ Heap::CollectAllGarbage(false);
+
+ SetScriptBreakPointByNameFromJS("test.html", 3, -1);
+
+ // Call f and check that there was no break points.
+ break_point_hit_count = 0;
+ f->Call(env->Global(), 0, NULL);
+ CHECK_EQ(0, break_point_hit_count);
+
+ // Recompile and run script and check that break point was hit.
+ break_point_hit_count = 0;
+ v8::Script::Compile(script, v8::String::New("test.html"))->Run();
+ CHECK_EQ(1, break_point_hit_count);
+
+ // Call f and check that there are still no break points.
+ break_point_hit_count = 0;
+ f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ CHECK_EQ(0, break_point_hit_count);
+
+ v8::Debug::SetDebugEventListener(NULL);
+ CheckDebuggerUnloaded();
+}
+
+
// Test that it is possible to remove the last break point for a function
// inside the break handling of that break point.
TEST(RemoveBreakPointInBreak) {
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/debug-setbreakpoint.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698