Browse Source

Add failing spec for no specified storage keys

Kevin Sawicki 8 years ago
parent
commit
2fe83bc5f0
2 changed files with 17 additions and 5 deletions
  1. 5 2
      spec/api-browser-window-spec.js
  2. 12 3
      spec/fixtures/devtools-extensions/foo/index.html

+ 5 - 2
spec/api-browser-window-spec.js

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

+ 12 - 3
spec/fixtures/devtools-extensions/foo/index.html

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