Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 chrome.test.runTests([ | |
| 6 // Tests if the <extensionoptions> guest view is successfully created. This | |
| 7 // test expects that the guest options page will add a {'pass': true} property | |
| 8 // to every Window and fire the runtime.onMessage event with a short message. | |
| 9 function canCreateExtensionOptionsGuest() { | |
| 10 chrome.test.listenOnce(chrome.runtime.onMessage, | |
| 11 function(message, sender, sendResponse) { | |
| 12 var views = chrome.extension.getViews(); | |
| 13 chrome.test.assertEq(2, views.length); | |
| 14 views.forEach(function(view) { | |
| 15 chrome.test.assertTrue(view.pass); | |
| 16 }); | |
| 17 chrome.test.assertEq('hi', message); | |
| 18 chrome.test.assertEq(chrome.runtime.id, sender.id); | |
| 19 chrome.test.succeed(); | |
|
not at google - send to devlin
2014/07/18 22:59:34
remove the element from the DOM after this?
ericzeng
2014/07/19 00:43:44
Done.
| |
| 20 }); | |
| 21 | |
| 22 var extensionoptions = document.createElement('extensionoptions'); | |
| 23 extensionoptions.setAttribute('extension', chrome.runtime.id); | |
| 24 document.body.appendChild(extensionoptions); | |
| 25 }, | |
| 26 | |
| 27 // Tests if the <extensionoptions> guest view can access the chrome.storage | |
| 28 // API, a privileged extension API. | |
| 29 function guestCanAccessStorage() { | |
| 30 chrome.test.listenOnce(chrome.storage.onChanged, function(change) { | |
| 31 chrome.test.assertEq(42, change.test.newValue); | |
| 32 }); | |
| 33 | |
| 34 var extensionoptions = document.createElement('extensionoptions'); | |
| 35 extensionoptions.setAttribute('extension', chrome.runtime.id); | |
| 36 document.body.appendChild(extensionoptions); | |
| 37 } | |
| 38 ]); | |
| OLD | NEW |