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

Unified Diff: test/inspector/inspector-test.cc

Issue 2678313002: [inspector] support for nested scheduled breaks (Closed)
Patch Set: better test Created 3 years, 10 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 | « test/inspector/debugger/inspector-break-api.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/inspector-test.cc
diff --git a/test/inspector/inspector-test.cc b/test/inspector/inspector-test.cc
index 841be28f043fcf6fbc60f04830896c1c332aa215..b3dbcb4f52a9cd05733236a0f83dffa46a742f0f 100644
--- a/test/inspector/inspector-test.cc
+++ b/test/inspector/inspector-test.cc
@@ -335,7 +335,8 @@ class InspectorExtension : public v8::Extension {
"native function detachInspector();"
"native function setMaxAsyncTaskStacks();"
"native function breakProgram();"
- "native function createObjectWithStrictCheck();") {}
+ "native function createObjectWithStrictCheck();"
+ "native function callWithScheduledBreak();") {}
virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Local<v8::String> name) {
@@ -373,6 +374,13 @@ class InspectorExtension : public v8::Extension {
.FromJust()) {
return v8::FunctionTemplate::New(
isolate, InspectorExtension::CreateObjectWithStrictCheck);
+ } else if (name->Equals(context, v8::String::NewFromUtf8(
+ isolate, "callWithScheduledBreak",
+ v8::NewStringType::kNormal)
+ .ToLocalChecked())
+ .FromJust()) {
+ return v8::FunctionTemplate::New(
+ isolate, InspectorExtension::CallWithScheduledBreak);
}
return v8::Local<v8::FunctionTemplate>();
}
@@ -447,6 +455,30 @@ class InspectorExtension : public v8::Extension {
templ->NewInstance(args.GetIsolate()->GetCurrentContext())
.ToLocalChecked());
}
+
+ static void CallWithScheduledBreak(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ if (args.Length() != 3 || !args[0]->IsFunction() || !args[1]->IsString() ||
+ !args[2]->IsString()) {
+ fprintf(stderr, "Internal error: breakProgram('reason', 'details').");
+ Exit();
+ }
+ v8_inspector::V8InspectorSession* session =
+ InspectorClientImpl::SessionFromContext(
+ args.GetIsolate()->GetCurrentContext());
+ CHECK(session);
+
+ v8::internal::Vector<uint16_t> reason = ToVector(args[1].As<v8::String>());
+ v8_inspector::StringView reason_view(reason.start(), reason.length());
+ v8::internal::Vector<uint16_t> details = ToVector(args[2].As<v8::String>());
+ v8_inspector::StringView details_view(details.start(), details.length());
+ session->schedulePauseOnNextStatement(reason_view, details_view);
+ v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+ v8::MaybeLocal<v8::Value> result;
+ result = args[0].As<v8::Function>()->Call(context, context->Global(), 0,
+ nullptr);
+ session->cancelPauseOnNextStatement();
+ }
};
v8::Local<v8::String> ToString(v8::Isolate* isolate,
« no previous file with comments | « test/inspector/debugger/inspector-break-api.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698