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

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

Issue 237793003: Use default CSP for resource loading in webview (instead of platform app's CSP) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment to added file Created 6 years, 8 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 124d26cfb9aa6aa83a2fe431a2f2b030ba5b75a6..7ee8e1cac939106828807686b3d6c226d124dc5b 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
@@ -305,7 +305,7 @@ function testAPIMethodExistence() {
// 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 localResource = chrome.runtime.getURL('guest_with_inline_script.html');
var webview = document.createElement('webview');
// foobar is a privileged partition according to the manifest file.
webview.partition = 'foobar';
@@ -332,7 +332,26 @@ function testChromeExtensionRelativePath() {
webview.addEventListener('loadstop', function(e) {
embedder.test.succeed();
});
- webview.setAttribute('src', 'guest.html');
+ webview.setAttribute('src', 'guest_with_inline_script.html');
+ document.body.appendChild(webview);
+}
+
+// Makes sure inline scripts works inside guest that was loaded from
+// accessible_resources.
+function testInlineScriptFromAccessibleResources() {
+ 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('consolemessage', function(e) {
+ window.console.log('consolemessage: ' + e.message);
+ if (e.message == 'guest_with_inline_script.html: Inline script ran') {
+ embedder.test.succeed();
+ }
+ });
+ webview.setAttribute('src', 'guest_with_inline_script.html');
document.body.appendChild(webview);
}
@@ -1502,6 +1521,8 @@ embedder.test.testList = {
'testAPIMethodExistence': testAPIMethodExistence,
'testChromeExtensionURL': testChromeExtensionURL,
'testChromeExtensionRelativePath': testChromeExtensionRelativePath,
+ 'testInlineScriptFromAccessibleResources':
+ testInlineScriptFromAccessibleResources,
'testInvalidChromeExtensionURL': testInvalidChromeExtensionURL,
'testWebRequestAPIExistence': testWebRequestAPIExistence,
'testEventName': testEventName,

Powered by Google App Engine
This is Rietveld 408576698