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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 9d63e7b3a6d47eb7e59a9ff2a0f490a2f557e8a4..386e32c30c2a307599a13090616c0c769e70cbce 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -319,6 +319,11 @@ static void ChangeBreakOnExceptionFromJS(v8::Isolate* isolate, bool caught,
}
}
+// Change break on exception using the native API call.
+static void ChangeBreakOnExceptionFromAPI(v8::Isolate* isolate,
+ v8::ExceptionBreakState state) {
+ v8::Debug::ChangeBreakOnException(isolate, state);
+}
// Prepare to step to next break location.
static void PrepareStep(StepAction step_action) {
@@ -3986,6 +3991,46 @@ TEST(BreakOnException) {
edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
DebugEventCounterCheck(4, 3, 2);
+ // No break on exception using native API
+ DebugEventCounterClear();
+ MessageCallbackCountClear();
+ ChangeBreakOnExceptionFromAPI(env->GetIsolate(), v8::NoBreakOnException);
+ caught->Call(context, env->Global(), 0, NULL).ToLocalChecked();
+ DebugEventCounterCheck(0, 0, 0);
+ CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty());
+ DebugEventCounterCheck(0, 0, 1);
+ CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty());
+ DebugEventCounterCheck(0, 0, 2);
+ edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
+ DebugEventCounterCheck(0, 0, 2);
+
+ // // Break on uncaught exception using native API
+ DebugEventCounterClear();
+ MessageCallbackCountClear();
+ ChangeBreakOnExceptionFromAPI(env->GetIsolate(),
+ v8::BreakOnUncaughtException);
+ caught->Call(context, env->Global(), 0, NULL).ToLocalChecked();
+ DebugEventCounterCheck(0, 0, 0);
+ CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty());
+ DebugEventCounterCheck(1, 1, 1);
+ CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty());
+ DebugEventCounterCheck(2, 2, 2);
+ edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
+ DebugEventCounterCheck(3, 3, 2);
+
+ // // Break on exception and uncaught exception using native API
+ DebugEventCounterClear();
+ MessageCallbackCountClear();
+ ChangeBreakOnExceptionFromAPI(env->GetIsolate(), v8::BreakOnAnyException);
+ caught->Call(context, env->Global(), 0, NULL).ToLocalChecked();
+ DebugEventCounterCheck(1, 0, 0);
+ CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty());
+ DebugEventCounterCheck(2, 1, 1);
+ CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty());
+ DebugEventCounterCheck(3, 2, 2);
+ edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
+ DebugEventCounterCheck(4, 3, 2);
+
v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
CheckDebuggerUnloaded(env->GetIsolate());
env->GetIsolate()->RemoveMessageListeners(MessageCallbackCount);

Powered by Google App Engine
This is Rietveld 408576698