Index: chrome/test/data/extensions/platform_apps/web_view/shim/main.js |
diff --git a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js |
index 78fb914f248ef3d3e979a90bd4c5b8e1c634623c..a911e2256d30233a932d9a0fcb6ef549332c7f81 100644 |
--- a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js |
+++ b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js |
@@ -583,13 +583,15 @@ function testCannotMutateEventName() { |
// been set raises an exception. |
function testPartitionRaisesException() { |
var webview = document.createElement('webview'); |
- webview.setAttribute('partition', arguments.callee.name); |
+ var partitionAttribute = arguments.callee.name; |
+ webview.setAttribute('partition', partitionAttribute); |
var loadstopHandler = function(e) { |
try { |
webview.partition = 'illegal'; |
embedder.test.fail(); |
} catch (e) { |
+ embedder.test.assertEq(partitionAttribute, webview.partition); |
embedder.test.succeed(); |
} |
}; |
@@ -599,6 +601,27 @@ function testPartitionRaisesException() { |
webview.setAttribute('src', 'data:text/html,trigger navigation'); |
} |
+// This test verifies that removing partition attribute after navigation does |
+// not work, i.e. the partition remains the same. |
+function testPartitionRemovalAfterNavigationFails() { |
+ var webview = document.createElement('webview'); |
+ document.body.appendChild(webview); |
+ |
+ var partition = 'testme'; |
+ webview.setAttribute('partition', partition); |
+ |
+ var loadstopHandler = function(e) { |
+ window.console.log('webview.loadstop'); |
+ // Removing after navigation should not change the partition. |
+ webview.removeAttribute('partition'); |
+ embedder.test.assertEq('testme', webview.partition); |
+ embedder.test.succeed(); |
+ }; |
+ webview.addEventListener('loadstop', loadstopHandler); |
+ |
+ webview.setAttribute('src', 'data:text/html,<html><body>guest</body></html>'); |
+} |
+ |
function testExecuteScriptFail() { |
var webview = document.createElement('webview'); |
document.body.appendChild(webview); |
@@ -1691,6 +1714,8 @@ embedder.test.testList = { |
'testDestroyOnEventListener': testDestroyOnEventListener, |
'testCannotMutateEventName': testCannotMutateEventName, |
'testPartitionRaisesException': testPartitionRaisesException, |
+ 'testPartitionRemovalAfterNavigationFails': |
+ testPartitionRemovalAfterNavigationFails, |
'testExecuteScriptFail': testExecuteScriptFail, |
'testExecuteScript': testExecuteScript, |
'testExecuteScriptIsAbortedWhenWebViewSourceIsChanged': |