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

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

Issue 2713023004: [inspector] added reconnect method for tests (Closed)
Patch Set: rebased 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/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 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;
« 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