Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 function optionsPageLoaded() { | 5 function optionsPageLoaded() { |
| 6 var hasLoaded = false; | 6 var hasLoaded = false; |
| 7 chrome.extension.getViews().forEach(function(view) { | 7 chrome.extension.getViews().forEach(function(view) { |
| 8 if (view.document.location.pathname == '/options.html') { | 8 if (view.document.location.pathname == '/options.html') { |
| 9 chrome.test.assertEq(false, hasLoaded); | 9 chrome.test.assertEq(false, hasLoaded); |
| 10 hasLoaded = view.loaded; | 10 hasLoaded = view.loaded; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 chrome.test.assertTrue(optionsPageLoaded()); | 40 chrome.test.assertTrue(optionsPageLoaded()); |
| 41 chrome.test.succeed(); | 41 chrome.test.succeed(); |
| 42 } finally { | 42 } finally { |
| 43 document.body.removeChild(extensionoptions); | 43 document.body.removeChild(extensionoptions); |
| 44 } | 44 } |
| 45 }; | 45 }; |
| 46 extensionoptions.extension = chrome.runtime.id; | 46 extensionoptions.extension = chrome.runtime.id; |
| 47 document.body.appendChild(extensionoptions); | 47 document.body.appendChild(extensionoptions); |
| 48 }, | 48 }, |
| 49 | 49 |
| 50 function createGuestViewDeferredAttach() { | |
| 51 var extensionoptions = new ExtensionOptions(); | |
| 52 extensionoptions.onload = function() { | |
| 53 try { | |
| 54 chrome.test.assertTrue(optionsPageLoaded()); | |
| 55 chrome.test.succeed(); | |
| 56 } finally { | |
| 57 document.body.removeChild(extensionoptions); | |
| 58 } | |
| 59 }; | |
| 60 extensionoptions.extension = chrome.runtime.id; | |
| 61 setTimeout(function() { | |
| 62 document.body.appendChild(extensionoptions); | |
| 63 }, 1000); | |
|
not at google - send to devlin
2014/08/12 19:58:29
Why 1000? Just make it 0, no need to make this tes
ericzeng
2014/08/12 21:53:33
Unfortunately I need a small delay in order to rep
| |
| 64 }, | |
| 65 | |
| 50 // Tests if the <extensionoptions> guest view is successfully created and can | 66 // Tests if the <extensionoptions> guest view is successfully created and can |
| 51 // communicate with the embedder. This test expects that the guest options | 67 // communicate with the embedder. This test expects that the guest options |
| 52 // page will add a {'pass': true} property to every Window and fire the | 68 // page will add a {'pass': true} property to every Window and fire the |
| 53 // runtime.onMessage event with a short message. | 69 // runtime.onMessage event with a short message. |
| 54 function canCommunicateWithGuest() { | 70 function canCommunicateWithGuest() { |
| 55 var done = chrome.test.listenForever(chrome.runtime.onMessage, | 71 var done = chrome.test.listenForever(chrome.runtime.onMessage, |
| 56 function(message, sender, sendResponse) { | 72 function(message, sender, sendResponse) { |
| 57 if (message == 'ready') { | 73 if (message == 'ready') { |
| 58 sendResponse('canCommunicateWithGuest'); | 74 sendResponse('canCommunicateWithGuest'); |
| 59 } else if (message == 'done') { | 75 } else if (message == 'done') { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 chrome.test.assertTrue(evt.height <= 501); | 147 chrome.test.assertTrue(evt.height <= 501); |
| 132 done(); | 148 done(); |
| 133 } finally { | 149 } finally { |
| 134 document.body.removeChild(extensionoptions); | 150 document.body.removeChild(extensionoptions); |
| 135 } | 151 } |
| 136 }; | 152 }; |
| 137 | 153 |
| 138 document.body.appendChild(extensionoptions); | 154 document.body.appendChild(extensionoptions); |
| 139 } | 155 } |
| 140 ]); | 156 ]); |
| OLD | NEW |