Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 // Flags: --expose-wasm | 5 // Flags: --expose-wasm |
| 6 | 6 |
| 7 // Basic tests. | 7 // Basic tests. |
| 8 | 8 |
| 9 var outOfUint32RangeValue = 1e12; | 9 var outOfUint32RangeValue = 1e12; |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 })(); | 35 })(); |
| 36 | 36 |
| 37 (function TestConstructorWithMaximum() { | 37 (function TestConstructorWithMaximum() { |
| 38 let memory = new WebAssembly.Memory({initial: 1, maximum: 10}); | 38 let memory = new WebAssembly.Memory({initial: 1, maximum: 10}); |
| 39 assertSame(WebAssembly.Memory.prototype, memory.__proto__); | 39 assertSame(WebAssembly.Memory.prototype, memory.__proto__); |
| 40 assertSame(WebAssembly.Memory, memory.constructor); | 40 assertSame(WebAssembly.Memory, memory.constructor); |
| 41 assertTrue(memory instanceof Object); | 41 assertTrue(memory instanceof Object); |
| 42 assertTrue(memory instanceof WebAssembly.Memory); | 42 assertTrue(memory instanceof WebAssembly.Memory); |
| 43 })(); | 43 })(); |
| 44 | 44 |
| 45 (function TestInitialIsUndefined() { | |
|
Franzi
2016/09/23 17:23:28
I think this test passes without your change as we
ahaas
2016/09/26 09:19:12
Done, and I also added many more tests.
| |
| 46 // New memory with initial = undefined, which means initial = 0. | |
| 47 let memory = new WebAssembly.Memory({initial: undefined}); | |
| 48 assertSame(WebAssembly.Memory.prototype, memory.__proto__); | |
| 49 assertSame(WebAssembly.Memory, memory.constructor); | |
| 50 assertTrue(memory instanceof Object); | |
| 51 assertTrue(memory instanceof WebAssembly.Memory); | |
| 52 })(); | |
| 53 | |
| 45 (function TestBuffer() { | 54 (function TestBuffer() { |
| 46 let memory = new WebAssembly.Memory({initial: 1}); | 55 let memory = new WebAssembly.Memory({initial: 1}); |
| 47 assertTrue(memory.buffer instanceof Object); | 56 assertTrue(memory.buffer instanceof Object); |
| 48 assertTrue(memory.buffer instanceof ArrayBuffer); | 57 assertTrue(memory.buffer instanceof ArrayBuffer); |
| 49 assertThrows(() => {'use strict'; memory.buffer = memory.buffer}, TypeError) | 58 assertThrows(() => {'use strict'; memory.buffer = memory.buffer}, TypeError) |
| 50 assertThrows(() => ({__proto__: memory}).buffer, TypeError) | 59 assertThrows(() => ({__proto__: memory}).buffer, TypeError) |
| 51 })(); | 60 })(); |
| OLD | NEW |