| Index: chrome/test/data/wasm/wasm_tests.js
|
| diff --git a/chrome/test/data/wasm/wasm_tests.js b/chrome/test/data/wasm/wasm_tests.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..647714811a34b5031dcbc035fdf39bbba57c034c
|
| --- /dev/null
|
| +++ b/chrome/test/data/wasm/wasm_tests.js
|
| @@ -0,0 +1,29 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// Utility function. Use this to return data back to the C++ test.
|
| +function respondToTestHarness(data) {
|
| + if (!window.domAutomationController) {
|
| + console.log("ERROR: no automation controller available");
|
| + return;
|
| + }
|
| + window.domAutomationController.send(data);
|
| +}
|
| +
|
| +function test_instantiateInWorker() {
|
| + fetch('incrementer.wasm')
|
| + .then(response => {
|
| + if (!response.ok) throw new Error(response.statusText);
|
| + return response.arrayBuffer();
|
| + })
|
| + .then(data => {
|
| + var mod = new WebAssembly.Module(data);
|
| + var worker = new Worker("wasm_serialization_worker.js");
|
| + worker.postMessage(mod);
|
| + worker.onmessage = function(event) {
|
| + respondToTestHarness(event.data);
|
| + }
|
| + })
|
| + .catch(error => respondToTestHarness(error.message));
|
| +}
|
|
|