| 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 var embedder = {}; | 5 var embedder = {}; |
| 6 | 6 |
| 7 // TODO(lfg) Move these functions to a common js. | 7 // TODO(lfg) Move these functions to a common js. |
| 8 embedder.setUp_ = function(config) { | 8 embedder.setUp_ = function(config) { |
| 9 if (!config || !config.testServer) { | 9 if (!config || !config.testServer) { |
| 10 return; | 10 return; |
| (...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 embedder.test.succeed(); | 1275 embedder.test.succeed(); |
| 1276 }; | 1276 }; |
| 1277 | 1277 |
| 1278 webview.setAttribute('src', 'data:text/html,next navigation'); | 1278 webview.setAttribute('src', 'data:text/html,next navigation'); |
| 1279 }); | 1279 }); |
| 1280 | 1280 |
| 1281 webview.setAttribute('src', 'data:text/html,trigger navigation'); | 1281 webview.setAttribute('src', 'data:text/html,trigger navigation'); |
| 1282 document.body.appendChild(webview); | 1282 document.body.appendChild(webview); |
| 1283 } | 1283 } |
| 1284 | 1284 |
| 1285 // This test verifies that setting the partition attribute after the src has | 1285 // This test verifies that the partion attribute cannot be changed after the src |
| 1286 // been set raises an exception. | 1286 // has been set. |
| 1287 function testPartitionRaisesException() { | 1287 function testPartitionChangeAfterNavigation() { |
| 1288 var webview = document.createElement('webview'); | 1288 var webview = document.createElement('webview'); |
| 1289 var partitionAttribute = arguments.callee.name; | 1289 var partitionAttribute = arguments.callee.name; |
| 1290 webview.setAttribute('partition', partitionAttribute); | 1290 webview.setAttribute('partition', partitionAttribute); |
| 1291 | 1291 |
| 1292 var loadstopHandler = function(e) { | 1292 var loadstopHandler = function(e) { |
| 1293 try { | 1293 webview.partition = 'illegal'; |
| 1294 webview.partition = 'illegal'; | 1294 embedder.test.assertEq(partitionAttribute, webview.partition); |
| 1295 embedder.test.fail(); | 1295 embedder.test.succeed(); |
| 1296 } catch (e) { | |
| 1297 embedder.test.assertEq(partitionAttribute, webview.partition); | |
| 1298 embedder.test.succeed(); | |
| 1299 } | |
| 1300 }; | 1296 }; |
| 1301 webview.addEventListener('loadstop', loadstopHandler); | 1297 webview.addEventListener('loadstop', loadstopHandler); |
| 1302 | 1298 |
| 1303 webview.setAttribute('src', 'data:text/html,trigger navigation'); | 1299 webview.setAttribute('src', 'data:text/html,trigger navigation'); |
| 1304 document.body.appendChild(webview); | 1300 document.body.appendChild(webview); |
| 1305 } | 1301 } |
| 1306 | 1302 |
| 1307 // This test verifies that removing partition attribute after navigation does | 1303 // This test verifies that removing partition attribute after navigation does |
| 1308 // not work, i.e. the partition remains the same. | 1304 // not work, i.e. the partition remains the same. |
| 1309 function testPartitionRemovalAfterNavigationFails() { | 1305 function testPartitionRemovalAfterNavigationFails() { |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 'testNavigateAfterResize': testNavigateAfterResize, | 1696 'testNavigateAfterResize': testNavigateAfterResize, |
| 1701 'testNavigationToExternalProtocol': testNavigationToExternalProtocol, | 1697 'testNavigationToExternalProtocol': testNavigationToExternalProtocol, |
| 1702 'testNavOnConsecutiveSrcAttributeChanges': | 1698 'testNavOnConsecutiveSrcAttributeChanges': |
| 1703 testNavOnConsecutiveSrcAttributeChanges, | 1699 testNavOnConsecutiveSrcAttributeChanges, |
| 1704 'testNavOnSrcAttributeChange': testNavOnSrcAttributeChange, | 1700 'testNavOnSrcAttributeChange': testNavOnSrcAttributeChange, |
| 1705 'testNewWindow': testNewWindow, | 1701 'testNewWindow': testNewWindow, |
| 1706 'testNewWindowNoPreventDefault': testNewWindowNoPreventDefault, | 1702 'testNewWindowNoPreventDefault': testNewWindowNoPreventDefault, |
| 1707 'testNewWindowNoReferrerLink': testNewWindowNoReferrerLink, | 1703 'testNewWindowNoReferrerLink': testNewWindowNoReferrerLink, |
| 1708 'testNewWindowTwoListeners': testNewWindowTwoListeners, | 1704 'testNewWindowTwoListeners': testNewWindowTwoListeners, |
| 1709 'testOnEventProperties': testOnEventProperties, | 1705 'testOnEventProperties': testOnEventProperties, |
| 1710 'testPartitionRaisesException': testPartitionRaisesException, | 1706 'testPartitionChangeAfterNavigation': testPartitionChangeAfterNavigation, |
| 1711 'testPartitionRemovalAfterNavigationFails': | 1707 'testPartitionRemovalAfterNavigationFails': |
| 1712 testPartitionRemovalAfterNavigationFails, | 1708 testPartitionRemovalAfterNavigationFails, |
| 1713 'testReassignSrcAttribute': testReassignSrcAttribute, | 1709 'testReassignSrcAttribute': testReassignSrcAttribute, |
| 1714 'testReload': testReload, | 1710 'testReload': testReload, |
| 1715 'testReloadAfterTerminate': testReloadAfterTerminate, | 1711 'testReloadAfterTerminate': testReloadAfterTerminate, |
| 1716 'testRemoveSrcAttribute': testRemoveSrcAttribute, | 1712 'testRemoveSrcAttribute': testRemoveSrcAttribute, |
| 1717 'testRemoveWebviewAfterNavigation': testRemoveWebviewAfterNavigation, | 1713 'testRemoveWebviewAfterNavigation': testRemoveWebviewAfterNavigation, |
| 1718 'testRemoveWebviewOnExit': testRemoveWebviewOnExit, | 1714 'testRemoveWebviewOnExit': testRemoveWebviewOnExit, |
| 1719 'testResizeWebviewResizesContent': testResizeWebviewResizesContent, | 1715 'testResizeWebviewResizesContent': testResizeWebviewResizesContent, |
| 1720 'testTerminateAfterExit': testTerminateAfterExit, | 1716 'testTerminateAfterExit': testTerminateAfterExit, |
| 1721 'testWebRequestAPI': testWebRequestAPI, | 1717 'testWebRequestAPI': testWebRequestAPI, |
| 1722 'testWebRequestAPIWithHeaders': testWebRequestAPIWithHeaders, | 1718 'testWebRequestAPIWithHeaders': testWebRequestAPIWithHeaders, |
| 1723 'testWebRequestAPIExistence': testWebRequestAPIExistence, | 1719 'testWebRequestAPIExistence': testWebRequestAPIExistence, |
| 1724 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty | 1720 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty |
| 1725 }; | 1721 }; |
| 1726 | 1722 |
| 1727 onload = function() { | 1723 onload = function() { |
| 1728 chrome.test.getConfig(function(config) { | 1724 chrome.test.getConfig(function(config) { |
| 1729 embedder.setUp_(config); | 1725 embedder.setUp_(config); |
| 1730 chrome.test.sendMessage('LAUNCHED'); | 1726 chrome.test.sendMessage('LAUNCHED'); |
| 1731 }); | 1727 }); |
| 1732 }; | 1728 }; |
| OLD | NEW |