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

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

Issue 2713023004: [inspector] added reconnect method for tests (Closed)
Patch Set: 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
Index: test/inspector/inspector-test.cc
diff --git a/test/inspector/inspector-test.cc b/test/inspector/inspector-test.cc
index b3dbcb4f52a9cd05733236a0f83dffa46a742f0f..c512a45b773e38685daf9b2d9029ae2d7b115e03 100644
--- a/test/inspector/inspector-test.cc
+++ b/test/inspector/inspector-test.cc
@@ -57,7 +57,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();
@@ -113,6 +114,12 @@ class UtilsExtension : public v8::Extension {
.FromJust()) {
return v8::FunctionTemplate::New(
isolate, UtilsExtension::CancelPauseOnNextStatement);
+ } else if (name->Equals(context,
+ v8::String::NewFromUtf8(isolate, "reconnect",
dgozman 2017/02/27 18:44:56 I remember you promised to scope all the extension
kozy 2017/02/27 19:57:13 Done. I wrapped them in protocol-test.js and conti
+ v8::NewStringType::kNormal)
+ .ToLocalChecked())
+ .FromJust()) {
+ return v8::FunctionTemplate::New(isolate, UtilsExtension::Reconnect);
}
return v8::Local<v8::FunctionTemplate>();
}
@@ -246,6 +253,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;

Powered by Google App Engine
This is Rietveld 408576698