OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3818 foo->Call(env->Global(), 0, NULL); | 3818 foo->Call(env->Global(), 0, NULL); |
3819 | 3819 |
3820 // Without stepping only the debugger statement is hit. | 3820 // Without stepping only the debugger statement is hit. |
3821 CHECK_EQ(1, break_point_hit_count); | 3821 CHECK_EQ(1, break_point_hit_count); |
3822 | 3822 |
3823 v8::Debug::SetDebugEventListener(NULL); | 3823 v8::Debug::SetDebugEventListener(NULL); |
3824 CheckDebuggerUnloaded(); | 3824 CheckDebuggerUnloaded(); |
3825 } | 3825 } |
3826 | 3826 |
3827 | 3827 |
3828 // Test that step in works with Function.call.apply. | |
3829 TEST(DebugStepFunctionCallApply) { | |
3830 DebugLocalContext env; | |
3831 v8::Isolate* isolate = env->GetIsolate(); | |
3832 v8::HandleScope scope(isolate); | |
3833 | |
3834 // Create a function for testing stepping. | |
3835 v8::Local<v8::Function> foo = | |
3836 CompileFunction(&env, | |
3837 "function bar() { }" | |
3838 "function foo(){ debugger;" | |
3839 " 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.
| |
3840 "}", | |
3841 "foo"); | |
3842 | |
3843 // Register a debug event listener which steps and counts. | |
3844 v8::Debug::SetDebugEventListener(DebugEventStep); | |
3845 step_action = StepIn; | |
3846 | |
3847 // Check stepping where the if condition in bar is false. | |
3848 break_point_hit_count = 0; | |
3849 foo->Call(env->Global(), 0, NULL); | |
3850 CHECK_EQ(4, break_point_hit_count); | |
3851 | |
3852 v8::Debug::SetDebugEventListener(NULL); | |
3853 CheckDebuggerUnloaded(); | |
3854 | |
3855 // Register a debug event listener which just counts. | |
3856 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount); | |
3857 | |
3858 break_point_hit_count = 0; | |
3859 foo->Call(env->Global(), 0, NULL); | |
3860 | |
3861 // Without stepping only the debugger statement is hit. | |
3862 CHECK_EQ(1, break_point_hit_count); | |
3863 | |
3864 v8::Debug::SetDebugEventListener(NULL); | |
3865 CheckDebuggerUnloaded(); | |
3866 } | |
3867 | |
3868 | |
3828 // Tests that breakpoint will be hit if it's set in script. | 3869 // Tests that breakpoint will be hit if it's set in script. |
3829 TEST(PauseInScript) { | 3870 TEST(PauseInScript) { |
3830 DebugLocalContext env; | 3871 DebugLocalContext env; |
3831 v8::HandleScope scope(env->GetIsolate()); | 3872 v8::HandleScope scope(env->GetIsolate()); |
3832 env.ExposeDebug(); | 3873 env.ExposeDebug(); |
3833 | 3874 |
3834 // Register a debug event listener which counts. | 3875 // Register a debug event listener which counts. |
3835 v8::Debug::SetDebugEventListener(DebugEventCounter); | 3876 v8::Debug::SetDebugEventListener(DebugEventCounter); |
3836 | 3877 |
3837 // Create a script that returns a function. | 3878 // Create a script that returns a function. |
(...skipping 3809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7647 "let y = 2; \n" | 7688 "let y = 2; \n" |
7648 "debugger; \n" | 7689 "debugger; \n" |
7649 "x * y", | 7690 "x * y", |
7650 30); | 7691 30); |
7651 ExpectInt32( | 7692 ExpectInt32( |
7652 "x = 1; y = 2; \n" | 7693 "x = 1; y = 2; \n" |
7653 "debugger;" | 7694 "debugger;" |
7654 "x * y", | 7695 "x * y", |
7655 30); | 7696 30); |
7656 } | 7697 } |
OLD | NEW |