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 0498d026f337ddf64b5b56f5131fb3590e42c5b4..1fd3a2fc371df02a3f4401048042f8674e5f4762 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 |
@@ -299,6 +299,23 @@ function testAPIMethodExistence() { |
document.body.appendChild(webview); |
} |
+// This test verifies that the loadstop event fires when loading a webview |
+// accessible resource from a partition that is privileged. |
+function testChromeExtensionURL() { |
+ var localResource = chrome.runtime.getURL('guest.html'); |
+ var webview = document.createElement('webview'); |
+ // foobar is a privileged partition according to the manifest file. |
+ webview.partition = 'foobar'; |
+ webview.addEventListener('loadabort', function(e) { |
+ embedder.test.fail(); |
+ }); |
+ webview.addEventListener('loadstop', function(e) { |
+ embedder.test.succeed(); |
+ }); |
+ webview.setAttribute('src', localResource); |
+ document.body.appendChild(webview); |
+} |
+ |
function testWebRequestAPIExistence() { |
var apiPropertiesToCheck = [ |
'onBeforeRequest', |
@@ -882,6 +899,22 @@ function testLoadStartLoadRedirect() { |
document.body.appendChild(webview); |
} |
+// This test verifies that the loadabort event fires when loading a webview |
+// accessible resource from a partition that is not privileged. |
+function testLoadAbortChromeExtensionURLWrongPartition() { |
+ var localResource = chrome.runtime.getURL('guest.html'); |
+ var webview = document.createElement('webview'); |
+ webview.addEventListener('loadabort', function(e) { |
+ embedder.test.assertEq('ERR_ADDRESS_UNREACHABLE', e.reason); |
+ embedder.test.succeed(); |
+ }); |
+ webview.addEventListener('loadstop', function(e) { |
+ embedder.test.fail(); |
+ }); |
+ webview.setAttribute('src', localResource); |
+ document.body.appendChild(webview); |
+} |
+ |
// This test verifies that the loadabort event fires as expected and with the |
// appropriate fields when an empty response is returned. |
function testLoadAbortEmptyResponse() { |
@@ -1055,6 +1088,7 @@ embedder.test.testList = { |
'testAutosizeRemoveAttributes': testAutosizeRemoveAttributes, |
'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes, |
'testAPIMethodExistence': testAPIMethodExistence, |
+ 'testChromeExtensionURL': testChromeExtensionURL, |
'testWebRequestAPIExistence': testWebRequestAPIExistence, |
'testEventName': testEventName, |
'testOnEventProperties': testOnEventProperties, |
@@ -1083,6 +1117,8 @@ embedder.test.testList = { |
testWebRequestListenerSurvivesReparenting, |
'testGetProcessId': testGetProcessId, |
'testLoadStartLoadRedirect': testLoadStartLoadRedirect, |
+ 'testLoadAbortChromeExtensionURLWrongPartition': |
+ testLoadAbortChromeExtensionURLWrongPartition, |
'testLoadAbortEmptyResponse': testLoadAbortEmptyResponse, |
'testLoadAbortIllegalChromeURL': testLoadAbortIllegalChromeURL, |
'testLoadAbortIllegalFileURL': testLoadAbortIllegalFileURL, |