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

Unified Diff: test/mjsunit/wasm/memory.js

Issue 2638243002: [wasm] WebAssembly.Memory.grow() should handle the no instance case (Closed)
Patch Set: Review Created 3 years, 11 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
« no previous file with comments | « test/mjsunit/wasm/js-api.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/memory.js
diff --git a/test/mjsunit/wasm/memory.js b/test/mjsunit/wasm/memory.js
index e86825bd27c7000a88c047e5b392d1e9e386b377..1fbe0581b170d11581ea8f8130193b0be73ec3fd 100644
--- a/test/mjsunit/wasm/memory.js
+++ b/test/mjsunit/wasm/memory.js
@@ -91,3 +91,13 @@ function assertMemoryIsValid(memory) {
assertThrows(() => {'use strict'; memory.buffer = memory.buffer}, TypeError)
assertThrows(() => ({__proto__: memory}).buffer, TypeError)
})();
+
+(function TestMemoryGrow() {
+ var kPageSize = 65536;
+ let memory = new WebAssembly.Memory({initial: 1, maximum:30});
+ assertEquals(1, memory.grow(9));
+ assertTrue(memory.buffer instanceof ArrayBuffer);
+ assertTrue(10*kPageSize == memory.buffer.byteLength);
+ assertMemoryIsValid(memory);
+ assertThrows(() => memory.grow(21));
+})();
« no previous file with comments | « test/mjsunit/wasm/js-api.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698