Chromium Code Reviews| Index: test/cctest/test-debug.cc |
| diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc |
| index 25a75103e3704e5f7938877b8d56fee2ea9b2ffc..409e46aac538dab507e97a1bfd811d0394e2ac14 100644 |
| --- a/test/cctest/test-debug.cc |
| +++ b/test/cctest/test-debug.cc |
| @@ -3825,6 +3825,47 @@ TEST(DebugStepFunctionCall) { |
| } |
| +// Test that step in works with Function.call.apply. |
| +TEST(DebugStepFunctionCallApply) { |
| + DebugLocalContext env; |
| + v8::Isolate* isolate = env->GetIsolate(); |
| + v8::HandleScope scope(isolate); |
| + |
| + // Create a function for testing stepping. |
| + v8::Local<v8::Function> foo = |
| + CompileFunction(&env, |
| + "function bar() { }" |
| + "function foo(){ debugger;" |
| + " Function.call.apply(bar);" |
|
yurys
2015/06/16 10:37:15
Can you add one more test for a deeper case, somet
kozy
2015/06/16 10:49:58
Done.
|
| + "}", |
| + "foo"); |
| + |
| + // Register a debug event listener which steps and counts. |
| + v8::Debug::SetDebugEventListener(DebugEventStep); |
| + step_action = StepIn; |
| + |
| + // Check stepping where the if condition in bar is false. |
| + break_point_hit_count = 0; |
| + foo->Call(env->Global(), 0, NULL); |
| + CHECK_EQ(4, break_point_hit_count); |
| + |
| + v8::Debug::SetDebugEventListener(NULL); |
| + CheckDebuggerUnloaded(); |
| + |
| + // Register a debug event listener which just counts. |
| + v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount); |
| + |
| + break_point_hit_count = 0; |
| + foo->Call(env->Global(), 0, NULL); |
| + |
| + // Without stepping only the debugger statement is hit. |
| + CHECK_EQ(1, break_point_hit_count); |
| + |
| + v8::Debug::SetDebugEventListener(NULL); |
| + CheckDebuggerUnloaded(); |
| +} |
| + |
| + |
| // Tests that breakpoint will be hit if it's set in script. |
| TEST(PauseInScript) { |
| DebugLocalContext env; |