| 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 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 webview.addEventListener('loadcommit', function(e) { | 1360 webview.addEventListener('loadcommit', function(e) { |
| 1361 embedder.test.assertEq(triggerNavUrl, e.url); | 1361 embedder.test.assertEq(triggerNavUrl, e.url); |
| 1362 embedder.test.assertTrue(e.isTopLevel); | 1362 embedder.test.assertTrue(e.isTopLevel); |
| 1363 loadCommitCount++; | 1363 loadCommitCount++; |
| 1364 }); | 1364 }); |
| 1365 | 1365 |
| 1366 webview.setAttribute('src', triggerNavUrl); | 1366 webview.setAttribute('src', triggerNavUrl); |
| 1367 document.body.appendChild(webview); | 1367 document.body.appendChild(webview); |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 // This test verifies that the reload method on webview functions as expected. |
| 1371 function testReloadAfterTerminate() { |
| 1372 var triggerNavUrl = 'data:text/html,trigger navigation'; |
| 1373 var webview = document.createElement('webview'); |
| 1374 |
| 1375 var step = 1; |
| 1376 webview.addEventListener('loadstop', function(e) { |
| 1377 switch (step) { |
| 1378 case 1: |
| 1379 webview.terminate(); |
| 1380 break; |
| 1381 case 2: |
| 1382 setTimeout(function() { embedder.test.succeed(); }, 0); |
| 1383 break; |
| 1384 default: |
| 1385 window.console.log('Unexpected loadstop event, step = ' + step); |
| 1386 embedder.test.fail(); |
| 1387 break; |
| 1388 } |
| 1389 ++step; |
| 1390 }); |
| 1391 |
| 1392 webview.addEventListener('exit', function(e) { |
| 1393 // Trigger a focus state change of the guest to test for |
| 1394 // http://crbug.com/413874. |
| 1395 webview.blur(); |
| 1396 webview.focus(); |
| 1397 setTimeout(function() { webview.reload(); }, 0); |
| 1398 }); |
| 1399 |
| 1400 webview.src = triggerNavUrl; |
| 1401 document.body.appendChild(webview); |
| 1402 } |
| 1403 |
| 1370 // This test verifies that a <webview> is torn down gracefully when removed from | 1404 // This test verifies that a <webview> is torn down gracefully when removed from |
| 1371 // the DOM on exit. | 1405 // the DOM on exit. |
| 1372 | 1406 |
| 1373 window.removeWebviewOnExitDoCrash = null; | 1407 window.removeWebviewOnExitDoCrash = null; |
| 1374 | 1408 |
| 1375 function testRemoveWebviewOnExit() { | 1409 function testRemoveWebviewOnExit() { |
| 1376 var triggerNavUrl = 'data:text/html,trigger navigation'; | 1410 var triggerNavUrl = 'data:text/html,trigger navigation'; |
| 1377 var webview = document.createElement('webview'); | 1411 var webview = document.createElement('webview'); |
| 1378 | 1412 |
| 1379 webview.addEventListener('loadstop', function(e) { | 1413 webview.addEventListener('loadstop', function(e) { |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 testLoadAbortChromeExtensionURLWrongPartition, | 1861 testLoadAbortChromeExtensionURLWrongPartition, |
| 1828 'testLoadAbortEmptyResponse': testLoadAbortEmptyResponse, | 1862 'testLoadAbortEmptyResponse': testLoadAbortEmptyResponse, |
| 1829 'testLoadAbortIllegalChromeURL': testLoadAbortIllegalChromeURL, | 1863 'testLoadAbortIllegalChromeURL': testLoadAbortIllegalChromeURL, |
| 1830 'testLoadAbortIllegalFileURL': testLoadAbortIllegalFileURL, | 1864 'testLoadAbortIllegalFileURL': testLoadAbortIllegalFileURL, |
| 1831 'testLoadAbortIllegalJavaScriptURL': testLoadAbortIllegalJavaScriptURL, | 1865 'testLoadAbortIllegalJavaScriptURL': testLoadAbortIllegalJavaScriptURL, |
| 1832 'testLoadAbortInvalidNavigation': testLoadAbortInvalidNavigation, | 1866 'testLoadAbortInvalidNavigation': testLoadAbortInvalidNavigation, |
| 1833 'testLoadAbortNonWebSafeScheme': testLoadAbortNonWebSafeScheme, | 1867 'testLoadAbortNonWebSafeScheme': testLoadAbortNonWebSafeScheme, |
| 1834 'testNavigateAfterResize': testNavigateAfterResize, | 1868 'testNavigateAfterResize': testNavigateAfterResize, |
| 1835 'testNavigationToExternalProtocol': testNavigationToExternalProtocol, | 1869 'testNavigationToExternalProtocol': testNavigationToExternalProtocol, |
| 1836 'testReload': testReload, | 1870 'testReload': testReload, |
| 1871 'testReloadAfterTerminate': testReloadAfterTerminate, |
| 1837 'testRemoveWebviewOnExit': testRemoveWebviewOnExit, | 1872 'testRemoveWebviewOnExit': testRemoveWebviewOnExit, |
| 1838 'testRemoveWebviewAfterNavigation': testRemoveWebviewAfterNavigation, | 1873 'testRemoveWebviewAfterNavigation': testRemoveWebviewAfterNavigation, |
| 1839 'testResizeWebviewResizesContent': testResizeWebviewResizesContent, | 1874 'testResizeWebviewResizesContent': testResizeWebviewResizesContent, |
| 1840 'testPostMessageCommChannel': testPostMessageCommChannel, | 1875 'testPostMessageCommChannel': testPostMessageCommChannel, |
| 1841 'testScreenshotCapture' : testScreenshotCapture, | 1876 'testScreenshotCapture' : testScreenshotCapture, |
| 1842 'testZoomAPI' : testZoomAPI, | 1877 'testZoomAPI' : testZoomAPI, |
| 1843 'testFindAPI': testFindAPI, | 1878 'testFindAPI': testFindAPI, |
| 1844 'testFindAPI_findupdate': testFindAPI | 1879 'testFindAPI_findupdate': testFindAPI |
| 1845 }; | 1880 }; |
| 1846 | 1881 |
| 1847 onload = function() { | 1882 onload = function() { |
| 1848 chrome.test.getConfig(function(config) { | 1883 chrome.test.getConfig(function(config) { |
| 1849 embedder.setUp_(config); | 1884 embedder.setUp_(config); |
| 1850 chrome.test.sendMessage("Launched"); | 1885 chrome.test.sendMessage("Launched"); |
| 1851 }); | 1886 }); |
| 1852 }; | 1887 }; |
| OLD | NEW |