OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 var util = {}; | 5 var util = {}; |
6 var embedder = {}; | 6 var embedder = {}; |
7 embedder.baseGuestURL = ''; | 7 embedder.baseGuestURL = ''; |
8 embedder.emptyGuestURL = ''; | 8 embedder.emptyGuestURL = ''; |
9 embedder.windowOpenGuestURL = ''; | 9 embedder.windowOpenGuestURL = ''; |
10 embedder.noReferrerGuestURL = ''; | 10 embedder.noReferrerGuestURL = ''; |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 }; | 1231 }; |
1232 webview.request.onRequest.addRules([rule]); | 1232 webview.request.onRequest.addRules([rule]); |
1233 webview.request.onMessage.addListener(function(e) { | 1233 webview.request.onMessage.addListener(function(e) { |
1234 embedder.test.assertEq('bleep', e.message); | 1234 embedder.test.assertEq('bleep', e.message); |
1235 embedder.test.succeed(); | 1235 embedder.test.succeed(); |
1236 }); | 1236 }); |
1237 webview.src = embedder.emptyGuestURL; | 1237 webview.src = embedder.emptyGuestURL; |
1238 document.body.appendChild(webview); | 1238 document.body.appendChild(webview); |
1239 } | 1239 } |
1240 | 1240 |
| 1241 // This test verifies that setting a <webview>'s style.display = 'block' does |
| 1242 // not throw and attach error. |
| 1243 function testDisplayBlock() { |
| 1244 var webview = new WebView(); |
| 1245 webview.onloadstop = function(e) { |
| 1246 LOG('webview.onloadstop'); |
| 1247 window.console.error = function() { |
| 1248 // If we see an error, that means attach failed. |
| 1249 embedder.test.fail(); |
| 1250 }; |
| 1251 webview.style.display = 'block'; |
| 1252 embedder.test.assertTrue(webview.getProcessId() > 0); |
| 1253 |
| 1254 webview.onloadstop = function(e) { |
| 1255 LOG('Second webview.onloadstop'); |
| 1256 embedder.test.succeed(); |
| 1257 }; |
| 1258 webview.src = 'data:text/html,<body>Second load</body>'; |
| 1259 } |
| 1260 webview.src = 'about:blank'; |
| 1261 document.body.appendChild(webview); |
| 1262 } |
| 1263 |
1241 // This test verifies that the WebRequest API onBeforeRequest event fires on | 1264 // This test verifies that the WebRequest API onBeforeRequest event fires on |
1242 // clients*.google.com URLs. | 1265 // clients*.google.com URLs. |
1243 function testWebRequestAPIGoogleProperty() { | 1266 function testWebRequestAPIGoogleProperty() { |
1244 var webview = new WebView(); | 1267 var webview = new WebView(); |
1245 webview.request.onBeforeRequest.addListener(function(e) { | 1268 webview.request.onBeforeRequest.addListener(function(e) { |
1246 embedder.test.succeed(); | 1269 embedder.test.succeed(); |
1247 return {cancel: true}; | 1270 return {cancel: true}; |
1248 }, { urls: ['<all_urls>']}, ['blocking']) ; | 1271 }, { urls: ['<all_urls>']}, ['blocking']) ; |
1249 webview.src = 'http://clients6.google.com'; | 1272 webview.src = 'http://clients6.google.com'; |
1250 document.body.appendChild(webview); | 1273 document.body.appendChild(webview); |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2120 'testPluginLoadPermission': testPluginLoadPermission, | 2143 'testPluginLoadPermission': testPluginLoadPermission, |
2121 'testNewWindow': testNewWindow, | 2144 'testNewWindow': testNewWindow, |
2122 'testNewWindowTwoListeners': testNewWindowTwoListeners, | 2145 'testNewWindowTwoListeners': testNewWindowTwoListeners, |
2123 'testNewWindowNoPreventDefault': testNewWindowNoPreventDefault, | 2146 'testNewWindowNoPreventDefault': testNewWindowNoPreventDefault, |
2124 'testNewWindowNoReferrerLink': testNewWindowNoReferrerLink, | 2147 'testNewWindowNoReferrerLink': testNewWindowNoReferrerLink, |
2125 'testContentLoadEvent': testContentLoadEvent, | 2148 'testContentLoadEvent': testContentLoadEvent, |
2126 'testContentLoadEventWithDisplayNone': testContentLoadEventWithDisplayNone, | 2149 'testContentLoadEventWithDisplayNone': testContentLoadEventWithDisplayNone, |
2127 'testDeclarativeWebRequestAPI': testDeclarativeWebRequestAPI, | 2150 'testDeclarativeWebRequestAPI': testDeclarativeWebRequestAPI, |
2128 'testDeclarativeWebRequestAPISendMessage': | 2151 'testDeclarativeWebRequestAPISendMessage': |
2129 testDeclarativeWebRequestAPISendMessage, | 2152 testDeclarativeWebRequestAPISendMessage, |
| 2153 'testDisplayBlock': testDisplayBlock, |
2130 'testWebRequestAPI': testWebRequestAPI, | 2154 'testWebRequestAPI': testWebRequestAPI, |
2131 'testWebRequestAPIWithHeaders': testWebRequestAPIWithHeaders, | 2155 'testWebRequestAPIWithHeaders': testWebRequestAPIWithHeaders, |
2132 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty, | 2156 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty, |
2133 'testWebRequestListenerSurvivesReparenting': | 2157 'testWebRequestListenerSurvivesReparenting': |
2134 testWebRequestListenerSurvivesReparenting, | 2158 testWebRequestListenerSurvivesReparenting, |
2135 'testGetProcessId': testGetProcessId, | 2159 'testGetProcessId': testGetProcessId, |
2136 'testHiddenBeforeNavigation': testHiddenBeforeNavigation, | 2160 'testHiddenBeforeNavigation': testHiddenBeforeNavigation, |
2137 'testLoadStartLoadRedirect': testLoadStartLoadRedirect, | 2161 'testLoadStartLoadRedirect': testLoadStartLoadRedirect, |
2138 'testLoadAbortChromeExtensionURLWrongPartition': | 2162 'testLoadAbortChromeExtensionURLWrongPartition': |
2139 testLoadAbortChromeExtensionURLWrongPartition, | 2163 testLoadAbortChromeExtensionURLWrongPartition, |
(...skipping 20 matching lines...) Expand all Loading... |
2160 'testLoadDataAPI': testLoadDataAPI, | 2184 'testLoadDataAPI': testLoadDataAPI, |
2161 'testResizeEvents': testResizeEvents | 2185 'testResizeEvents': testResizeEvents |
2162 }; | 2186 }; |
2163 | 2187 |
2164 onload = function() { | 2188 onload = function() { |
2165 chrome.test.getConfig(function(config) { | 2189 chrome.test.getConfig(function(config) { |
2166 embedder.setUp_(config); | 2190 embedder.setUp_(config); |
2167 chrome.test.sendMessage("Launched"); | 2191 chrome.test.sendMessage("Launched"); |
2168 }); | 2192 }); |
2169 }; | 2193 }; |
OLD | NEW |