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

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

Issue 2737603006: [inspector] added createContextGroup for tests (Closed)
Patch Set: a Created 3 years, 9 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/inspector-impl.cc ('k') | test/inspector/protocol-test.js » ('j') | 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 0c99c5d50c4da34889dc560cafaf986ee7e62aca..96cd8d569736d6169b4a8fdd18815518543fc190 100644
--- a/test/inspector/inspector-test.cc
+++ b/test/inspector/inspector-test.cc
@@ -59,7 +59,8 @@ class UtilsExtension : public v8::Extension {
"native function setCurrentTimeMSForTest();"
"native function schedulePauseOnNextStatement();"
"native function cancelPauseOnNextStatement();"
- "native function reconnect();") {}
+ "native function reconnect();"
+ "native function createContextGroup();") {}
virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Local<v8::String> name) {
v8::Local<v8::Context> context = isolate->GetCurrentContext();
@@ -127,6 +128,13 @@ class UtilsExtension : public v8::Extension {
.ToLocalChecked())
.FromJust()) {
return v8::FunctionTemplate::New(isolate, UtilsExtension::Reconnect);
+ } else if (name->Equals(context, v8::String::NewFromUtf8(
+ isolate, "createContextGroup",
+ v8::NewStringType::kNormal)
+ .ToLocalChecked())
+ .FromJust()) {
+ return v8::FunctionTemplate::New(isolate,
+ UtilsExtension::CreateContextGroup);
}
return v8::Local<v8::FunctionTemplate>();
}
@@ -280,6 +288,7 @@ class UtilsExtension : public v8::Extension {
fprintf(stderr, "Internal error: cancelPauseOnNextStatement().");
Exit();
}
+ v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
inspector_client_->session()->cancelPauseOnNextStatement();
}
@@ -292,6 +301,25 @@ class UtilsExtension : public v8::Extension {
inspector_client_->scheduleReconnect(&ready_semaphore);
ready_semaphore.Wait();
}
+
+ static void CreateContextGroup(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ if (args.Length() != 0) {
+ fprintf(stderr, "Internal error: createContextGroup().");
+ Exit();
+ }
+ const char* backend_extensions[] = {"v8_inspector/setTimeout",
+ "v8_inspector/inspector"};
+ v8::ExtensionConfiguration backend_configuration(
+ arraysize(backend_extensions), backend_extensions);
+ v8::base::Semaphore ready_semaphore(0);
+ int context_group_id = 0;
+ inspector_client_->scheduleCreateContextGroup(
+ &backend_configuration, &ready_semaphore, &context_group_id);
+ ready_semaphore.Wait();
+ args.GetReturnValue().Set(
+ v8::Int32::New(args.GetIsolate(), context_group_id));
+ }
};
TaskRunner* UtilsExtension::backend_runner_ = nullptr;
« no previous file with comments | « test/inspector/inspector-impl.cc ('k') | test/inspector/protocol-test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698