Add failing spec for no specified storage keys

This commit is contained in:
Kevin Sawicki 2016-06-28 13:01:51 -07:00
parent 6081cba15d
commit 2fe83bc5f0
2 changed files with 17 additions and 5 deletions

View file

@ -1025,7 +1025,7 @@ describe('browser-window module', function () {
}, /Unexpected token }/) }, /Unexpected token }/)
}) })
describe('when the devtools is docked', function () { describe.only('when the devtools is docked', function () {
it('creates the extension', function (done) { it('creates the extension', function (done) {
w.webContents.openDevTools({mode: 'bottom'}) w.webContents.openDevTools({mode: 'bottom'})
@ -1033,7 +1033,10 @@ describe('browser-window module', function () {
assert.equal(message.runtimeId, 'foo') assert.equal(message.runtimeId, 'foo')
assert.equal(message.tabId, w.webContents.id) assert.equal(message.tabId, w.webContents.id)
assert.equal(message.i18nString, 'foo - bar (baz)') assert.equal(message.i18nString, 'foo - bar (baz)')
assert.deepEqual(message.storageItems, {foo: 'bar'}) assert.deepEqual(message.storageItems, {
local: {hello: 'world'},
sync: {foo: 'bar'}
})
done() done()
}) })
}) })

View file

@ -6,16 +6,25 @@
<script> <script>
function testStorage (callback) { function testStorage (callback) {
chrome.storage.sync.set({foo: 'bar'}, function () { chrome.storage.sync.set({foo: 'bar'}, function () {
chrome.storage.sync.get({foo: 'baz'}, callback) chrome.storage.sync.get({foo: 'baz'}, function (syncItems) {
chrome.storage.local.set({hello: 'world'}, function () {
chrome.storage.local.get(null, function(localItems) {
callback(syncItems, localItems)
})
})
})
}) })
} }
testStorage(function (items) { testStorage(function (syncItems, localItems) {
var message = JSON.stringify({ var message = JSON.stringify({
runtimeId: chrome.runtime.id, runtimeId: chrome.runtime.id,
tabId: chrome.devtools.inspectedWindow.tabId, tabId: chrome.devtools.inspectedWindow.tabId,
i18nString: chrome.i18n.getMessage('foo', ['bar', 'baz']), i18nString: chrome.i18n.getMessage('foo', ['bar', 'baz']),
storageItems: items storageItems: {
local: localItems,
sync: syncItems
}
}) })
var sendMessage = `require('electron').ipcRenderer.send('answer', ${message})` var sendMessage = `require('electron').ipcRenderer.send('answer', ${message})`
window.chrome.devtools.inspectedWindow.eval(sendMessage, function () {}) window.chrome.devtools.inspectedWindow.eval(sendMessage, function () {})