+// Test that breakpoint_relocation flag is honored
+TEST(ScriptBreakPointNoRelocation) {
+ i::FLAG_breakpoint_relocation = false;
+
+ v8::HandleScope scope;
+ DebugLocalContext env;
+ env.ExposeDebug();
+
+ // Create a function for checking the function when hitting a break point.
+ frame_function_name = CompileFunction(&env,
+ frame_function_name_source,
+ "frame_function_name");
+
+ v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
+ v8::Undefined());
+
+ v8::Local<v8::String> script1 = v8::String::New(
+ "a = 0 // line 0\n"
+ " // line 1\n"
+ " // line 2\n"
+ " // line 3\n"
+ "function f() { // line 4\n"
+ " return 0; // line 5\n"
+ "} // line 6");
+
+ // Set the script break point on the empty line
+ SetScriptBreakPointByNameFromJS("test.html", 2, -1);
+
+ // Compile the script and call the function.
+ v8::ScriptOrigin origin(v8::String::New("test.html"), v8::Integer::New(0));
+ v8::Script::Compile(script1, &origin)->Run();
+ v8::Local<v8::Function> f
+ = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f->Call(env->Global(), 0, NULL);
+
+ // Check that a break point was not hit
+ CHECK_EQ(0, break_point_hit_count);
+
+ v8::Local<v8::String> script2 = v8::String::New(
+ "a = 0 // line 0\n"
+ "function g() { // line 1\n"
+ " return 0; // line 2\n"
+ "} // line 3\n"
+ "function f() { // line 4\n"
+ " return 0; // line 5\n"
+ "} // line 6");
+
+ // Compile the script and call the new function
+ v8::Script::Compile(script2, &origin)->Run();
+ v8::Local<v8::Function> g
+ = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g")));
+ g->Call(env->Global(), 0, NULL);
+
+ // Check that a break point was not hit
+ CHECK_EQ(1, break_point_hit_count);
+
+ v8::Debug::SetDebugEventListener(NULL);
+ CheckDebuggerUnloaded();
+}