Index: test/inspector/inspector-test.cc |
diff --git a/test/inspector/inspector-test.cc b/test/inspector/inspector-test.cc |
index 2aeff592ca481da5495ca90cc2588557471a5536..d2d44402d76cdca0272d663ab9a5dbf123522aa1 100644 |
--- a/test/inspector/inspector-test.cc |
+++ b/test/inspector/inspector-test.cc |
@@ -58,7 +58,8 @@ class UtilsExtension : public v8::Extension { |
"native function compileAndRunWithOrigin();" |
"native function setCurrentTimeMSForTest();" |
"native function schedulePauseOnNextStatement();" |
- "native function cancelPauseOnNextStatement();") {} |
+ "native function cancelPauseOnNextStatement();" |
+ "native function reconnect();") {} |
virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( |
v8::Isolate* isolate, v8::Local<v8::String> name) { |
v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
@@ -120,6 +121,12 @@ class UtilsExtension : public v8::Extension { |
.FromJust()) { |
return v8::FunctionTemplate::New( |
isolate, UtilsExtension::CancelPauseOnNextStatement); |
+ } else if (name->Equals(context, |
+ v8::String::NewFromUtf8(isolate, "reconnect", |
+ v8::NewStringType::kNormal) |
+ .ToLocalChecked()) |
+ .FromJust()) { |
+ return v8::FunctionTemplate::New(isolate, UtilsExtension::Reconnect); |
} |
return v8::Local<v8::FunctionTemplate>(); |
} |
@@ -275,6 +282,16 @@ class UtilsExtension : public v8::Extension { |
} |
inspector_client_->session()->cancelPauseOnNextStatement(); |
} |
+ |
+ static void Reconnect(const v8::FunctionCallbackInfo<v8::Value>& args) { |
+ if (args.Length() != 0) { |
+ fprintf(stderr, "Internal error: reconnect()."); |
+ Exit(); |
+ } |
+ v8::base::Semaphore ready_semaphore(0); |
+ inspector_client_->scheduleReconnect(&ready_semaphore); |
+ ready_semaphore.Wait(); |
+ } |
}; |
TaskRunner* UtilsExtension::backend_runner_ = nullptr; |