Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1532)

Unified Diff: chrome/test/data/extensions/platform_apps/web_view/shim/main.js

Issue 22793018: <webview>: Implement support for package-local chrome-extension:// URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test that broken Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,
« no previous file with comments | « chrome/common/extensions/webview_handler.cc ('k') | chrome/test/data/extensions/platform_apps/web_view/shim/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698