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

Unified Diff: test/cctest/test-debug.cc

Issue 2396193002: [inspector] move changeBreakpointState from debugger-script to native (Closed)
Patch Set: rebased 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
« no previous file with comments | « src/inspector/v8-debugger-agent-impl.cc ('k') | test/inspector/debugger/break-on-exception.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 9d63e7b3a6d47eb7e59a9ff2a0f490a2f557e8a4..3b43d9d11fb73ba89905a394d277db285d5ec1b4 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -33,13 +33,13 @@
#include "src/base/platform/condition-variable.h"
#include "src/base/platform/platform.h"
#include "src/compilation-cache.h"
+#include "src/debug/debug-interface.h"
#include "src/debug/debug.h"
#include "src/deoptimizer.h"
#include "src/frames.h"
#include "src/utils.h"
#include "test/cctest/cctest.h"
-
using ::v8::base::Mutex;
using ::v8::base::LockGuard;
using ::v8::base::ConditionVariable;
@@ -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::DebugInterface::ExceptionBreakState state) {
+ v8::DebugInterface::ChangeBreakOnException(isolate, state);
+}
// Prepare to step to next break location.
static void PrepareStep(StepAction step_action) {
@@ -3986,6 +3991,48 @@ 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::DebugInterface::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::DebugInterface::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::DebugInterface::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);
« no previous file with comments | « src/inspector/v8-debugger-agent-impl.cc ('k') | test/inspector/debugger/break-on-exception.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698