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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/wasm/wasm_serialization_tests.js

Issue 2255673003: [wasm] Support wasm module structured cloning. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: LayoutTests and virtual path Created 4 years, 3 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
Index: third_party/WebKit/LayoutTests/http/tests/wasm/wasm_serialization_tests.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/wasm/wasm_serialization_tests.js b/third_party/WebKit/LayoutTests/http/tests/wasm/wasm_serialization_tests.js
new file mode 100644
index 0000000000000000000000000000000000000000..1a29a51818a214cac04741d180e805e67b78e73b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/wasm/wasm_serialization_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.
+
+function instantiateInWorker() {
+ // the file incrementer.wasm is copied from
+ // //v8/test/mjsunit/wasm. This is because currently we cannot
+ // reference files outside the LayoutTests folder. When wasm format
+ // changes require that file to be updated, there is a test on the
+ // v8 side (same folder), ensure-wasm-binaries-up-to-date.js, which
+ // fails and will require incrementer.wasm to be updated on that side.
+ return 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");
+ return new Promise((resolve, reject) => {
+ worker.postMessage(mod);
+ worker.onmessage = function(event) {
+ resolve(event.data);
+ }
+ });
+ })
+ .then(data => assert_equals(data, 43))
+ .catch(error => assert_unreached(error));
+}

Powered by Google App Engine
This is Rietveld 408576698