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

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

Issue 1220813013: This patch enables "mailto" links in WebViews. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test. Rebased. Created 5 years, 5 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 7934855593b20a92df106f4d2e3f9515e22199d5..619bda560ddf58476fa91dfa6736405bc4591f39 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
@@ -41,6 +41,8 @@ embedder.setUp_ = function(config) {
embedder.virtualURL = 'http://virtualurl/';
embedder.pluginURL = embedder.baseGuestURL +
'/extensions/platform_apps/web_view/shim/embed.html';
+ embedder.mailtoTestURL = embedder.baseGuestURL +
+ '/extensions/platform_apps/web_view/shim/mailto.html';
};
window.runTest = function(testName) {
@@ -2733,6 +2735,30 @@ function testPDFInWebview() {
document.body.appendChild(webview);
}
+// This test verifies that mailto links are enabled.
+function testMailtoLink() {
+ var webview = new WebView();
+ webview.src = embedder.mailtoTestURL;
+
+ webview.onloadstop = function() {
+ webview.onloadabort = function(e) {
+ // The mailto link should not trigger a loadabort.
+ if (e.url.substring(0, 7) == 'mailto:') {
+ embedder.test.fail();
+ }
+ };
+ webview.onloadstop = function() {
+ // If mailto links are disabled, then |webview.src| will now be
+ // 'about:blank'.
+ embedder.test.assertFalse(webview.src == 'about:blank');
+ embedder.test.succeed();
+ };
+ webview.executeScript({code:'document.getElementById("mailto").click()'});
+ };
+
+ document.body.appendChild(webview);
+}
+
embedder.test.testList = {
'testAllowTransparencyAttribute': testAllowTransparencyAttribute,
'testAutosizeHeight': testAutosizeHeight,
@@ -2834,7 +2860,8 @@ embedder.test.testList = {
'testGarbageCollect': testGarbageCollect,
'testCloseNewWindowCleanup': testCloseNewWindowCleanup,
'testFocusWhileFocused': testFocusWhileFocused,
- 'testPDFInWebview': testPDFInWebview
+ 'testPDFInWebview': testPDFInWebview,
+ 'testMailtoLink': testMailtoLink
};
onload = function() {

Powered by Google App Engine
This is Rietveld 408576698