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

Side by Side Diff: test/cctest/test-debug.cc

Issue 384120: Test that pause can be set in script and won't lead to crash when execution i... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after
2721 foo->Call(env->Global(), 0, NULL); 2721 foo->Call(env->Global(), 0, NULL);
2722 2722
2723 // Without stepping only the debugger statement is hit. 2723 // Without stepping only the debugger statement is hit.
2724 CHECK_EQ(1, break_point_hit_count); 2724 CHECK_EQ(1, break_point_hit_count);
2725 2725
2726 v8::Debug::SetDebugEventListener(NULL); 2726 v8::Debug::SetDebugEventListener(NULL);
2727 CheckDebuggerUnloaded(); 2727 CheckDebuggerUnloaded();
2728 } 2728 }
2729 2729
2730 2730
2731 // Tests that breakpoint will be hit if it's set in script.
2732 TEST(PauseInScript) {
2733 v8::HandleScope scope;
2734 DebugLocalContext env;
2735 env.ExposeDebug();
2736
2737 // Register a debug event listener which counts.
2738 v8::Debug::SetDebugEventListener(DebugEventCounter);
2739
2740 // Create a script that returns a function.
2741 const char* src = "(function (evt) {})";
2742 const char* script_name = "StepInHandlerTest";
2743
2744 // Set breakpoint in the script.
2745 SetScriptBreakPointByNameFromJS(script_name, 0, -1);
2746 break_point_hit_count = 0;
2747
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),
2750 &origin);
2751 v8::Local<v8::Value> r = script->Run();
2752
2753 CHECK(r->IsFunction());
2754 CHECK_EQ(1, break_point_hit_count );
2755
2756 // Get rid of the debug event listener.
2757 v8::Debug::SetDebugEventListener(NULL);
2758 CheckDebuggerUnloaded();
2759 }
2760
2761
2731 // Test break on exceptions. For each exception break combination the number 2762 // Test break on exceptions. For each exception break combination the number
2732 // of debug event exception callbacks and message callbacks are collected. The 2763 // of debug event exception callbacks and message callbacks are collected. The
2733 // 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
2734 // debugger is called correctly and the number of message callbacks is used to 2765 // debugger is called correctly and the number of message callbacks is used to
2735 // check that uncaught exceptions are still returned even if there is a break 2766 // check that uncaught exceptions are still returned even if there is a break
2736 // for them. 2767 // for them.
2737 TEST(BreakOnException) { 2768 TEST(BreakOnException) {
2738 v8::HandleScope scope; 2769 v8::HandleScope scope;
2739 DebugLocalContext env; 2770 DebugLocalContext env;
2740 env.ExposeDebug(); 2771 env.ExposeDebug();
(...skipping 2826 matching lines...) Expand 10 before | Expand all | Expand 10 after
5567 break_point_hit_count = 0; 5598 break_point_hit_count = 0;
5568 max_break_point_hit_count = 10000; // 10000 => infinite loop. 5599 max_break_point_hit_count = 10000; // 10000 => infinite loop.
5569 foo->Call(env->Global(), 0, NULL); 5600 foo->Call(env->Global(), 0, NULL);
5570 5601
5571 // When keeping the debug break several break will happen. 5602 // When keeping the debug break several break will happen.
5572 CHECK_EQ(3, break_point_hit_count); 5603 CHECK_EQ(3, break_point_hit_count);
5573 5604
5574 v8::Debug::SetDebugEventListener(NULL); 5605 v8::Debug::SetDebugEventListener(NULL);
5575 CheckDebuggerUnloaded(); 5606 CheckDebuggerUnloaded();
5576 } 5607 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698