OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 |
| 6 function TestStreamedCompile() { |
| 7 return fetch('incrementer.wasm') |
| 8 .then(WebAssembly.compile) |
| 9 .then(m => new WebAssembly.Instance(m)) |
| 10 .then(i => assert_equals(5, i.exports.increment(4))); |
| 11 } |
| 12 |
| 13 function TestShortFormStreamedCompile() { |
| 14 return WebAssembly.compile(fetch('incrementer.wasm')) |
| 15 .then(m => new WebAssembly.Instance(m)) |
| 16 .then(i => assert_equals(5, i.exports.increment(4))); |
| 17 } |
| 18 |
| 19 function NegativeTestStreamedCompilePromise() { |
| 20 return WebAssembly.compile(new Promise((resolve, reject)=>{resolve(5);})) |
| 21 .then(assert_unreached, |
| 22 e => assert_true(e instanceof TypeError)); |
| 23 } |
OLD | NEW |