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

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

Issue 2384373002: [inspector] introduced exceptionThrown support in test runner (Closed)
Patch Set: addressed comments Created 4 years, 2 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 e073bfafddf9587fb6dc9ec6a009537b72cd00a7..1dec10b654060639f039114d63e61ad64e89debc 100644
--- a/test/inspector/inspector-test.cc
+++ b/test/inspector/inspector-test.cc
@@ -128,15 +128,25 @@ class SetTimeoutExtension : public v8::Extension {
private:
static void SetTimeout(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
- if (args.Length() != 2 || !args[1]->IsNumber() || !args[0]->IsFunction() ||
+ if (args.Length() != 2 || !args[1]->IsNumber() ||
+ (!args[0]->IsFunction() && !args[0]->IsString()) ||
args[1].As<v8::Number>()->Value() != 0.0) {
fprintf(stderr,
"Internal error: only setTimeout(function, 0) is supported.");
Exit();
}
v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
- TaskRunner::FromContext(context)->Append(new SetTimeoutTask(
- args.GetIsolate(), v8::Local<v8::Function>::Cast(args[0])));
+ if (args[0]->IsFunction()) {
+ TaskRunner::FromContext(context)->Append(new SetTimeoutTask(
+ args.GetIsolate(), v8::Local<v8::Function>::Cast(args[0])));
+ } else {
+ v8::Local<v8::String> data = args[0].As<v8::String>();
+ std::unique_ptr<uint16_t[]> buffer(new uint16_t[data->Length()]);
+ data->Write(reinterpret_cast<uint16_t*>(buffer.get()), 0, data->Length());
+ v8_inspector::String16 source =
+ v8_inspector::String16(buffer.get(), data->Length());
+ TaskRunner::FromContext(context)->Append(new ExecuteStringTask(source));
+ }
}
};
@@ -189,7 +199,7 @@ int main(int argc, char* argv[]) {
const char* backend_extensions[] = {"v8_inspector/setTimeout"};
v8::ExtensionConfiguration backend_configuration(
arraysize(backend_extensions), backend_extensions);
- TaskRunner backend_runner(&backend_configuration, &ready_semaphore);
+ TaskRunner backend_runner(&backend_configuration, false, &ready_semaphore);
ready_semaphore.Wait();
SendMessageToBackendExtension::set_backend_task_runner(&backend_runner);
@@ -197,7 +207,7 @@ int main(int argc, char* argv[]) {
"v8_inspector/frontend"};
v8::ExtensionConfiguration frontend_configuration(
arraysize(frontend_extensions), frontend_extensions);
- TaskRunner frontend_runner(&frontend_configuration, &ready_semaphore);
+ TaskRunner frontend_runner(&frontend_configuration, true, &ready_semaphore);
ready_semaphore.Wait();
FrontendChannelImpl frontend_channel(&frontend_runner);
« 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