Skip to content

Commit

Permalink
test: add test of DOM storage quota override
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobq committed Nov 6, 2018
1 parent 1cb8343 commit a9938de
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions spec/chromium-spec.js
Expand Up @@ -937,6 +937,23 @@ describe('chromium feature', () => {
})

describe('storage', () => {
describe('DOM storage quota override', () => {
['localStorage', 'sessionStorage'].forEach((storageName) => {
it(`can store at least 50MiB in ${storageName}`, (done) => {
assert.doesNotThrow(() => {
const storage = window[storageName]
const testKeyName = '_electronDOMStorageQuotaOverrideTest'
// 25 * 2^20 UTF-16 characters will require 50MiB
const arraySize = 25 * Math.pow(2, 20)
storage[testKeyName] = new Array(arraySize).fill('X').join('')
assert.strictEqual(storage[testKeyName].length, arraySize)
delete storage[testKeyName]
done()
})
})
})
})

it('requesting persitent quota works', (done) => {
navigator.webkitPersistentStorage.requestQuota(1024 * 1024, (grantedBytes) => {
assert.strictEqual(grantedBytes, 1048576)
Expand Down

0 comments on commit a9938de

Please sign in to comment.