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

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

Issue 63055: Fixed the step in handling for function.apply (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 8 months 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 | « src/debug.cc ('k') | test/mjsunit/bugs/bug-269.js » ('j') | 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 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after
2399 foo->Call(env->Global(), 0, NULL); 2399 foo->Call(env->Global(), 0, NULL);
2400 2400
2401 // Without stepping only active break points are hit. 2401 // Without stepping only active break points are hit.
2402 CHECK_EQ(1, break_point_hit_count); 2402 CHECK_EQ(1, break_point_hit_count);
2403 2403
2404 v8::Debug::SetDebugEventListener(NULL); 2404 v8::Debug::SetDebugEventListener(NULL);
2405 CheckDebuggerUnloaded(); 2405 CheckDebuggerUnloaded();
2406 } 2406 }
2407 2407
2408 2408
2409 // Test that step in works with function.apply.
2410 TEST(DebugStepFunctionApply) {
2411 v8::HandleScope scope;
2412 DebugLocalContext env;
2413
2414 // Create a function for testing stepping.
2415 v8::Local<v8::Function> foo = CompileFunction(
2416 &env,
2417 "function bar(x, y, z) { if (x == 1) { a = y; b = z; } }"
2418 "function foo(){ debugger; bar.apply(this, [1,2,3]); }",
2419 "foo");
2420
2421 // Register a debug event listener which steps and counts.
2422 v8::Debug::SetDebugEventListener(DebugEventStep);
2423
2424 step_action = StepIn;
2425 break_point_hit_count = 0;
2426 foo->Call(env->Global(), 0, NULL);
2427
2428 // With stepping all break locations are hit.
2429 CHECK_EQ(6, break_point_hit_count);
2430
2431 v8::Debug::SetDebugEventListener(NULL);
2432 CheckDebuggerUnloaded();
2433
2434 // Register a debug event listener which just counts.
2435 v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount);
2436
2437 break_point_hit_count = 0;
2438 foo->Call(env->Global(), 0, NULL);
2439
2440 // Without stepping only the debugger statement is hit.
2441 CHECK_EQ(1, break_point_hit_count);
2442
2443 v8::Debug::SetDebugEventListener(NULL);
2444 CheckDebuggerUnloaded();
2445 }
2446
2447
2409 // Test break on exceptions. For each exception break combination the number 2448 // Test break on exceptions. For each exception break combination the number
2410 // of debug event exception callbacks and message callbacks are collected. The 2449 // of debug event exception callbacks and message callbacks are collected. The
2411 // number of debug event exception callbacks are used to check that the 2450 // number of debug event exception callbacks are used to check that the
2412 // debugger is called correctly and the number of message callbacks is used to 2451 // debugger is called correctly and the number of message callbacks is used to
2413 // check that uncaught exceptions are still returned even if there is a break 2452 // check that uncaught exceptions are still returned even if there is a break
2414 // for them. 2453 // for them.
2415 TEST(BreakOnException) { 2454 TEST(BreakOnException) {
2416 v8::HandleScope scope; 2455 v8::HandleScope scope;
2417 DebugLocalContext env; 2456 DebugLocalContext env;
2418 env.ExposeDebug(); 2457 env.ExposeDebug();
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after
4090 bool allow_natives_syntax = i::FLAG_allow_natives_syntax; 4129 bool allow_natives_syntax = i::FLAG_allow_natives_syntax;
4091 i::FLAG_allow_natives_syntax = true; 4130 i::FLAG_allow_natives_syntax = true;
4092 CompileRun( 4131 CompileRun(
4093 "var scripts = %DebugGetLoadedScripts();" 4132 "var scripts = %DebugGetLoadedScripts();"
4094 "for (var i = 0; i < scripts.length; ++i) {" 4133 "for (var i = 0; i < scripts.length; ++i) {"
4095 " scripts[i].line_ends;" 4134 " scripts[i].line_ends;"
4096 "}"); 4135 "}");
4097 // Must not crash while accessing line_ends. 4136 // Must not crash while accessing line_ends.
4098 i::FLAG_allow_natives_syntax = allow_natives_syntax; 4137 i::FLAG_allow_natives_syntax = allow_natives_syntax;
4099 } 4138 }
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | test/mjsunit/bugs/bug-269.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698