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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/wasm/wasm-limits-tests.js

Issue 2778443003: [wasm] Use new override mechanism for wasm limits (Closed)
Patch Set: regression tests Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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() {
8 function ExpectTypeError(f) {
9 try {
10 f();
11 } catch (e) {
12 assert_true(e instanceof TypeError)
13 return;
14 }
15 assert_unreached();
16 }
17 ExpectTypeError(() => new WebAssembly.Module());
18 ExpectTypeError(() => new WebAssembly.Module("a"));
19 ExpectTypeError(() => new WebAssembly.Instance());
20 ExpectTypeError(() => new WebAssembly.Instance("a"));
21 }
22
23 function NoParameters_Promise() {
24 function ExpectTypeError(f) {
25 return f().then(assert_unreached, e => assert_true(e instanceof TypeError));
26 }
27 return Promise.all([
28 ExpectTypeError(() => WebAssembly.compile()),
29 ExpectTypeError(() => WebAssembly.compile("a")),
30 ExpectTypeError(() => WebAssembly.instantiate()),
31 ExpectTypeError(() => WebAssembly.instantiate("a"))
32 ]);
33 }
34
7 function TestBuffersAreCorrect() { 35 function TestBuffersAreCorrect() {
8 var buffs = createTestBuffers(limit); 36 var buffs = createTestBuffers(limit);
9 assert_equals(buffs.small.byteLength, limit); 37 assert_equals(buffs.small.byteLength, limit);
10 assert_equals(buffs.large.byteLength, limit + 1); 38 assert_equals(buffs.large.byteLength, limit + 1);
11 } 39 }
12 40
13 function compileFailsWithError(buffer, error_type) { 41 function compileFailsWithError(buffer, error_type) {
14 try { 42 try {
15 new WebAssembly.Module(buffer); 43 new WebAssembly.Module(buffer);
16 } catch (e) { 44 } catch (e) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 function TestPromiseCompileAsyncInstantiateFromModule() { 86 function TestPromiseCompileAsyncInstantiateFromModule() {
59 return WebAssembly.compile(createTestBuffers(limit).large) 87 return WebAssembly.compile(createTestBuffers(limit).large)
60 .then(m => { 88 .then(m => {
61 assert_true(m instanceof WebAssembly.Module); 89 assert_true(m instanceof WebAssembly.Module);
62 return WebAssembly.instantiate(m). 90 return WebAssembly.instantiate(m).
63 then(i => assert_true(i instanceof WebAssembly.Instance), 91 then(i => assert_true(i instanceof WebAssembly.Instance),
64 assert_unreached); 92 assert_unreached);
65 }, 93 },
66 assert_unreached); 94 assert_unreached);
67 } 95 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698