OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2737 // Register a debug event listener which counts. | 2737 // Register a debug event listener which counts. |
2738 v8::Debug::SetDebugEventListener(DebugEventCounter); | 2738 v8::Debug::SetDebugEventListener(DebugEventCounter); |
2739 | 2739 |
2740 // Create a script that returns a function. | 2740 // Create a script that returns a function. |
2741 const char* src = "(function (evt) {})"; | 2741 const char* src = "(function (evt) {})"; |
2742 const char* script_name = "StepInHandlerTest"; | 2742 const char* script_name = "StepInHandlerTest"; |
2743 | 2743 |
2744 // Set breakpoint in the script. | 2744 // Set breakpoint in the script. |
2745 SetScriptBreakPointByNameFromJS(script_name, 0, -1); | 2745 SetScriptBreakPointByNameFromJS(script_name, 0, -1); |
2746 break_point_hit_count = 0; | 2746 break_point_hit_count = 0; |
2747 | 2747 |
2748 v8::ScriptOrigin origin(v8::String::New(script_name), v8::Integer::New(0)); | 2748 v8::ScriptOrigin origin(v8::String::New(script_name), v8::Integer::New(0)); |
2749 v8::Handle<v8::Script> script = v8::Script::Compile(v8::String::New(src), | 2749 v8::Handle<v8::Script> script = v8::Script::Compile(v8::String::New(src), |
2750 &origin); | 2750 &origin); |
2751 v8::Local<v8::Value> r = script->Run(); | 2751 v8::Local<v8::Value> r = script->Run(); |
2752 | 2752 |
2753 CHECK(r->IsFunction()); | 2753 CHECK(r->IsFunction()); |
2754 CHECK_EQ(1, break_point_hit_count ); | 2754 CHECK_EQ(1, break_point_hit_count); |
2755 | 2755 |
2756 // Get rid of the debug event listener. | 2756 // Get rid of the debug event listener. |
2757 v8::Debug::SetDebugEventListener(NULL); | 2757 v8::Debug::SetDebugEventListener(NULL); |
2758 CheckDebuggerUnloaded(); | 2758 CheckDebuggerUnloaded(); |
2759 } | 2759 } |
2760 | 2760 |
2761 | 2761 |
2762 // Test break on exceptions. For each exception break combination the number | 2762 // Test break on exceptions. For each exception break combination the number |
2763 // of debug event exception callbacks and message callbacks are collected. The | 2763 // of debug event exception callbacks and message callbacks are collected. The |
2764 // number of debug event exception callbacks are used to check that the | 2764 // number of debug event exception callbacks are used to check that the |
(...skipping 2833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5598 break_point_hit_count = 0; | 5598 break_point_hit_count = 0; |
5599 max_break_point_hit_count = 10000; // 10000 => infinite loop. | 5599 max_break_point_hit_count = 10000; // 10000 => infinite loop. |
5600 foo->Call(env->Global(), 0, NULL); | 5600 foo->Call(env->Global(), 0, NULL); |
5601 | 5601 |
5602 // When keeping the debug break several break will happen. | 5602 // When keeping the debug break several break will happen. |
5603 CHECK_EQ(3, break_point_hit_count); | 5603 CHECK_EQ(3, break_point_hit_count); |
5604 | 5604 |
5605 v8::Debug::SetDebugEventListener(NULL); | 5605 v8::Debug::SetDebugEventListener(NULL); |
5606 CheckDebuggerUnloaded(); | 5606 CheckDebuggerUnloaded(); |
5607 } | 5607 } |
OLD | NEW |