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

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

Issue 2420093002: [wasm] Add inspector test for stack traces (Closed)
Patch Set: Remove obsolete code 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/debugger/wasm-stack-expected.txt ('k') | no next file » | 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 7fe6b8046862073f717e227fea94278cc86b2ff9..77310157a65298716de691212eeb51b64a25b942 100644
--- a/test/inspector/inspector-test.cc
+++ b/test/inspector/inspector-test.cc
@@ -33,7 +33,8 @@ class UtilsExtension : public v8::Extension {
: v8::Extension("v8_inspector/utils",
"native function print();"
"native function quit();"
- "native function setlocale();") {}
+ "native function setlocale();"
+ "native function load();") {}
virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Local<v8::String> name) {
v8::Local<v8::Context> context = isolate->GetCurrentContext();
@@ -54,6 +55,12 @@ class UtilsExtension : public v8::Extension {
.ToLocalChecked())
.FromJust()) {
return v8::FunctionTemplate::New(isolate, UtilsExtension::SetLocale);
+ } else if (name->Equals(context,
+ v8::String::NewFromUtf8(isolate, "load",
+ v8::NewStringType::kNormal)
+ .ToLocalChecked())
+ .FromJust()) {
+ return v8::FunctionTemplate::New(isolate, UtilsExtension::Load);
}
return v8::Local<v8::FunctionTemplate>();
}
@@ -102,6 +109,29 @@ class UtilsExtension : public v8::Extension {
v8::String::Utf8Value str(args[0]);
setlocale(LC_NUMERIC, *str);
}
+
+ static void Load(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ if (args.Length() != 1 || !args[0]->IsString()) {
+ fprintf(stderr, "Internal error: load gets one string argument.");
+ Exit();
+ }
+ v8::String::Utf8Value str(args[0]);
+ v8::Isolate* isolate = args.GetIsolate();
+ bool exists = false;
+ std::string filename(*str, str.length());
+ v8::internal::Vector<const char> chars =
+ v8::internal::ReadFile(filename.c_str(), &exists);
+ if (!exists) {
+ isolate->ThrowException(
+ v8::String::NewFromUtf8(isolate, "Error loading file",
+ v8::NewStringType::kNormal)
+ .ToLocalChecked());
+ return;
+ }
+ ExecuteStringTask task(chars);
+ v8::Global<v8::Context> context(isolate, isolate->GetCurrentContext());
+ task.Run(isolate, context);
+ }
};
class SetTimeoutTask : public TaskRunner::Task {
« no previous file with comments | « test/inspector/debugger/wasm-stack-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698