| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var limit = Math.pow(2, 12); | 5 var limit = Math.pow(2, 12); |
| 6 | 6 |
| 7 function NoParameters() { | 7 function NoParameters() { |
| 8 function ExpectTypeError(f) { | 8 function ExpectTypeError(f) { |
| 9 try { | 9 try { |
| 10 f(); | 10 f(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 function TestPromiseCompileAsyncInstantiateFromModule() { | 86 function TestPromiseCompileAsyncInstantiateFromModule() { |
| 87 return WebAssembly.compile(createTestBuffers(limit).large) | 87 return WebAssembly.compile(createTestBuffers(limit).large) |
| 88 .then(m => { | 88 .then(m => { |
| 89 assert_true(m instanceof WebAssembly.Module); | 89 assert_true(m instanceof WebAssembly.Module); |
| 90 return WebAssembly.instantiate(m). | 90 return WebAssembly.instantiate(m). |
| 91 then(i => assert_true(i instanceof WebAssembly.Instance), | 91 then(i => assert_true(i instanceof WebAssembly.Instance), |
| 92 assert_unreached); | 92 assert_unreached); |
| 93 }, | 93 }, |
| 94 assert_unreached); | 94 assert_unreached); |
| 95 } | 95 } |
| 96 |
| 97 |
| 98 function TestCompileFromPromise() { |
| 99 return Promise.resolve(createTestBuffers(limit).large) |
| 100 .then(WebAssembly.compile) |
| 101 .then(m => assert_true(m instanceof WebAssembly.Module)) |
| 102 } |
| 103 |
| 104 function TestInstantiateFromPromise() { |
| 105 return Promise.resolve(createTestBuffers(limit).large) |
| 106 .then(WebAssembly.instantiate) |
| 107 .then(pair => { |
| 108 assert_true(pair.module instanceof WebAssembly.Module); |
| 109 assert_true(pair.instance instanceof WebAssembly.Instance); |
| 110 }); |
| 111 } |
| 112 |
| 113 function TestInstantiateFromPromiseChain() { |
| 114 return Promise.resolve(createTestBuffers(limit).large) |
| 115 .then(WebAssembly.compile) |
| 116 .then(WebAssembly.instantiate) |
| 117 .then(i => assert_true(i instanceof WebAssembly.Instance)) |
| 118 } |
| OLD | NEW |