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

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

Issue 2396193002: [inspector] move changeBreakpointState from debugger-script to native (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } else { 312 } else {
313 CompileRunChecked(isolate, "debug.Debug.clearBreakOnException()"); 313 CompileRunChecked(isolate, "debug.Debug.clearBreakOnException()");
314 } 314 }
315 if (uncaught) { 315 if (uncaught) {
316 CompileRunChecked(isolate, "debug.Debug.setBreakOnUncaughtException()"); 316 CompileRunChecked(isolate, "debug.Debug.setBreakOnUncaughtException()");
317 } else { 317 } else {
318 CompileRunChecked(isolate, "debug.Debug.clearBreakOnUncaughtException()"); 318 CompileRunChecked(isolate, "debug.Debug.clearBreakOnUncaughtException()");
319 } 319 }
320 } 320 }
321 321
322 // Change break on exception using the native API call.
323 static void ChangeBreakOnExceptionFromAPI(v8::Isolate* isolate,
324 v8::ExceptionBreakState state) {
325 v8::Debug::ChangeBreakOnException(isolate, state);
326 }
322 327
323 // Prepare to step to next break location. 328 // Prepare to step to next break location.
324 static void PrepareStep(StepAction step_action) { 329 static void PrepareStep(StepAction step_action) {
325 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); 330 v8::internal::Debug* debug = CcTest::i_isolate()->debug();
326 debug->PrepareStep(step_action); 331 debug->PrepareStep(step_action);
327 } 332 }
328 333
329 334
330 static void ClearStepping() { CcTest::i_isolate()->debug()->ClearStepping(); } 335 static void ClearStepping() { CcTest::i_isolate()->debug()->ClearStepping(); }
331 336
(...skipping 3647 matching lines...) Expand 10 before | Expand all | Expand 10 after
3979 ChangeBreakOnExceptionFromJS(env->GetIsolate(), true, false); 3984 ChangeBreakOnExceptionFromJS(env->GetIsolate(), true, false);
3980 caught->Call(context, env->Global(), 0, NULL).ToLocalChecked(); 3985 caught->Call(context, env->Global(), 0, NULL).ToLocalChecked();
3981 DebugEventCounterCheck(1, 0, 0); 3986 DebugEventCounterCheck(1, 0, 0);
3982 CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty()); 3987 CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty());
3983 DebugEventCounterCheck(2, 1, 1); 3988 DebugEventCounterCheck(2, 1, 1);
3984 CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty()); 3989 CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty());
3985 DebugEventCounterCheck(3, 2, 2); 3990 DebugEventCounterCheck(3, 2, 2);
3986 edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked(); 3991 edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
3987 DebugEventCounterCheck(4, 3, 2); 3992 DebugEventCounterCheck(4, 3, 2);
3988 3993
3994 // No break on exception using native API
3995 DebugEventCounterClear();
3996 MessageCallbackCountClear();
3997 ChangeBreakOnExceptionFromAPI(env->GetIsolate(), v8::NoBreakOnException);
3998 caught->Call(context, env->Global(), 0, NULL).ToLocalChecked();
3999 DebugEventCounterCheck(0, 0, 0);
4000 CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty());
4001 DebugEventCounterCheck(0, 0, 1);
4002 CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty());
4003 DebugEventCounterCheck(0, 0, 2);
4004 edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
4005 DebugEventCounterCheck(0, 0, 2);
4006
4007 // // Break on uncaught exception using native API
4008 DebugEventCounterClear();
4009 MessageCallbackCountClear();
4010 ChangeBreakOnExceptionFromAPI(env->GetIsolate(),
4011 v8::BreakOnUncaughtException);
4012 caught->Call(context, env->Global(), 0, NULL).ToLocalChecked();
4013 DebugEventCounterCheck(0, 0, 0);
4014 CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty());
4015 DebugEventCounterCheck(1, 1, 1);
4016 CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty());
4017 DebugEventCounterCheck(2, 2, 2);
4018 edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
4019 DebugEventCounterCheck(3, 3, 2);
4020
4021 // // Break on exception and uncaught exception using native API
4022 DebugEventCounterClear();
4023 MessageCallbackCountClear();
4024 ChangeBreakOnExceptionFromAPI(env->GetIsolate(), v8::BreakOnAnyException);
4025 caught->Call(context, env->Global(), 0, NULL).ToLocalChecked();
4026 DebugEventCounterCheck(1, 0, 0);
4027 CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty());
4028 DebugEventCounterCheck(2, 1, 1);
4029 CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty());
4030 DebugEventCounterCheck(3, 2, 2);
4031 edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
4032 DebugEventCounterCheck(4, 3, 2);
4033
3989 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); 4034 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
3990 CheckDebuggerUnloaded(env->GetIsolate()); 4035 CheckDebuggerUnloaded(env->GetIsolate());
3991 env->GetIsolate()->RemoveMessageListeners(MessageCallbackCount); 4036 env->GetIsolate()->RemoveMessageListeners(MessageCallbackCount);
3992 } 4037 }
3993 4038
3994 4039
3995 static void try_finally_original_message(v8::Local<v8::Message> message, 4040 static void try_finally_original_message(v8::Local<v8::Message> message,
3996 v8::Local<v8::Value> data) { 4041 v8::Local<v8::Value> data) {
3997 v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext(); 4042 v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
3998 CHECK_EQ(2, message->GetLineNumber(context).FromJust()); 4043 CHECK_EQ(2, message->GetLineNumber(context).FromJust());
(...skipping 4184 matching lines...) Expand 10 before | Expand all | Expand 10 after
8183 "function foo() {\n" 8228 "function foo() {\n"
8184 " try { throw new Error(); } catch (e) {}\n" 8229 " try { throw new Error(); } catch (e) {}\n"
8185 "}\n" 8230 "}\n"
8186 "debugger;\n" 8231 "debugger;\n"
8187 "foo();\n" 8232 "foo();\n"
8188 "foo();\n"); 8233 "foo();\n");
8189 8234
8190 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); 8235 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
8191 CHECK_EQ(break_point_hit_count, 4); 8236 CHECK_EQ(break_point_hit_count, 4);
8192 } 8237 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698