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

Unified Diff: test/inspector/debugger/wasm-scripts.js

Issue 2531163010: [inspector] Introduce debug::WasmScript (Closed)
Patch Set: Rebase Created 4 years 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 | « src/inspector/wasm-translation.cc ('k') | test/inspector/debugger/wasm-scripts-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/debugger/wasm-scripts.js
diff --git a/test/inspector/debugger/wasm-scripts.js b/test/inspector/debugger/wasm-scripts.js
new file mode 100644
index 0000000000000000000000000000000000000000..6814269248737c9e9df0e8256cc9d8ee04376a10
--- /dev/null
+++ b/test/inspector/debugger/wasm-scripts.js
@@ -0,0 +1,53 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-wasm
+
+load('test/mjsunit/wasm/wasm-constants.js');
+load('test/mjsunit/wasm/wasm-module-builder.js');
+
+// Add two empty functions. Both should be registered as individual scripts at
+// module creation time.
+var builder = new WasmModuleBuilder();
+builder.addFunction('func0', kSig_v_v).addBody([]);
+builder.addFunction('func1', kSig_v_v).addBody([]).exportAs('main');
+var module_bytes = builder.toArray();
+
+function testFunction(bytes) {
+ var buffer = new ArrayBuffer(bytes.length);
+ var view = new Uint8Array(buffer);
+ for (var i = 0; i < bytes.length; i++) {
+ view[i] = bytes[i] | 0;
+ }
+
+ // Compilation triggers registration of wasm scripts.
+ new WebAssembly.Module(buffer);
+}
+
+function addSourceUrl(code, url) {
+ return '//# sourceURL=' + url + '\n' + code;
+}
+
+InspectorTest.addScript(
+ addSourceUrl(testFunction.toString(), 'v8://test/testFunction'));
+InspectorTest.addScript('var module_bytes = ' + JSON.stringify(module_bytes));
+
+Protocol.Debugger.enable();
+Protocol.Debugger.onScriptParsed(handleScriptParsed);
+InspectorTest.log(
+ 'Check that inspector gets two wasm scripts at module creation time.');
+Protocol.Runtime
+ .evaluate({
+ 'expression': addSourceUrl(
+ 'testFunction(module_bytes)', 'v8://test/runTestRunction')
+ })
+ .then(InspectorTest.completeTest());
+
+var num_scripts = 0;
+function handleScriptParsed(messageObject)
+{
+ var url = messageObject.params.url;
+ InspectorTest.log("Script #" + num_scripts + " parsed. URL: " + url);
kozy 2016/12/02 18:13:50 Can we request script content here and dump it as
Clemens Hammacher 2016/12/06 13:18:20 Done.
+ ++num_scripts;
+}
« no previous file with comments | « src/inspector/wasm-translation.cc ('k') | test/inspector/debugger/wasm-scripts-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698