| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var util = {}; | 5 var util = {}; |
| 6 var embedder = {}; | 6 var embedder = {}; |
| 7 embedder.baseGuestURL = ''; | 7 embedder.baseGuestURL = ''; |
| 8 embedder.emptyGuestURL = ''; | 8 embedder.emptyGuestURL = ''; |
| 9 embedder.windowOpenGuestURL = ''; | 9 embedder.windowOpenGuestURL = ''; |
| 10 embedder.noReferrerGuestURL = ''; | 10 embedder.noReferrerGuestURL = ''; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 embedder.detectUserAgentURL = embedder.baseGuestURL + '/detect-user-agent'; | 34 embedder.detectUserAgentURL = embedder.baseGuestURL + '/detect-user-agent'; |
| 35 embedder.redirectGuestURL = embedder.baseGuestURL + '/server-redirect'; | 35 embedder.redirectGuestURL = embedder.baseGuestURL + '/server-redirect'; |
| 36 embedder.redirectGuestURLDest = embedder.baseGuestURL + | 36 embedder.redirectGuestURLDest = embedder.baseGuestURL + |
| 37 '/extensions/platform_apps/web_view/shim/guest_redirect.html'; | 37 '/extensions/platform_apps/web_view/shim/guest_redirect.html'; |
| 38 embedder.closeSocketURL = embedder.baseGuestURL + '/close-socket'; | 38 embedder.closeSocketURL = embedder.baseGuestURL + '/close-socket'; |
| 39 embedder.testImageBaseURL = embedder.baseGuestURL + | 39 embedder.testImageBaseURL = embedder.baseGuestURL + |
| 40 '/extensions/platform_apps/web_view/shim/'; | 40 '/extensions/platform_apps/web_view/shim/'; |
| 41 embedder.virtualURL = 'http://virtualurl/'; | 41 embedder.virtualURL = 'http://virtualurl/'; |
| 42 embedder.pluginURL = embedder.baseGuestURL + | 42 embedder.pluginURL = embedder.baseGuestURL + |
| 43 '/extensions/platform_apps/web_view/shim/embed.html'; | 43 '/extensions/platform_apps/web_view/shim/embed.html'; |
| 44 embedder.mailtoTestURL = embedder.baseGuestURL + |
| 45 '/extensions/platform_apps/web_view/shim/mailto.html'; |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 window.runTest = function(testName) { | 48 window.runTest = function(testName) { |
| 47 if (!embedder.test.testList[testName]) { | 49 if (!embedder.test.testList[testName]) { |
| 48 console.log('Incorrect testName: ' + testName); | 50 console.log('Incorrect testName: ' + testName); |
| 49 embedder.test.fail(); | 51 embedder.test.fail(); |
| 50 return; | 52 return; |
| 51 } | 53 } |
| 52 | 54 |
| 53 // Run the test. | 55 // Run the test. |
| (...skipping 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2726 var webview = document.createElement('webview'); | 2728 var webview = document.createElement('webview'); |
| 2727 var pdfUrl = 'test.pdf'; | 2729 var pdfUrl = 'test.pdf'; |
| 2728 // partition 'foobar' has access to local resource |pdfUrl|. | 2730 // partition 'foobar' has access to local resource |pdfUrl|. |
| 2729 webview.partition = 'foobar'; | 2731 webview.partition = 'foobar'; |
| 2730 webview.onloadstop = embedder.test.succeed; | 2732 webview.onloadstop = embedder.test.succeed; |
| 2731 webview.onloadabort = embedder.test.fail; | 2733 webview.onloadabort = embedder.test.fail; |
| 2732 webview.setAttribute('src', pdfUrl); | 2734 webview.setAttribute('src', pdfUrl); |
| 2733 document.body.appendChild(webview); | 2735 document.body.appendChild(webview); |
| 2734 } | 2736 } |
| 2735 | 2737 |
| 2738 // This test verifies that mailto links are enabled. |
| 2739 function testMailtoLink() { |
| 2740 var webview = new WebView(); |
| 2741 webview.src = embedder.mailtoTestURL; |
| 2742 |
| 2743 webview.onloadstop = function() { |
| 2744 webview.onloadabort = function(e) { |
| 2745 // The mailto link should not trigger a loadabort. |
| 2746 if (e.url.substring(0, 7) == 'mailto:') { |
| 2747 embedder.test.fail(); |
| 2748 } |
| 2749 }; |
| 2750 webview.onloadstop = function() { |
| 2751 // If mailto links are disabled, then |webview.src| will now be |
| 2752 // 'about:blank'. |
| 2753 embedder.test.assertFalse(webview.src == 'about:blank'); |
| 2754 embedder.test.succeed(); |
| 2755 }; |
| 2756 webview.executeScript({code:'document.getElementById("mailto").click()'}); |
| 2757 }; |
| 2758 |
| 2759 document.body.appendChild(webview); |
| 2760 } |
| 2761 |
| 2736 embedder.test.testList = { | 2762 embedder.test.testList = { |
| 2737 'testAllowTransparencyAttribute': testAllowTransparencyAttribute, | 2763 'testAllowTransparencyAttribute': testAllowTransparencyAttribute, |
| 2738 'testAutosizeHeight': testAutosizeHeight, | 2764 'testAutosizeHeight': testAutosizeHeight, |
| 2739 'testAutosizeAfterNavigation': testAutosizeAfterNavigation, | 2765 'testAutosizeAfterNavigation': testAutosizeAfterNavigation, |
| 2740 'testAutosizeBeforeNavigation': testAutosizeBeforeNavigation, | 2766 'testAutosizeBeforeNavigation': testAutosizeBeforeNavigation, |
| 2741 'testAutosizeRemoveAttributes': testAutosizeRemoveAttributes, | 2767 'testAutosizeRemoveAttributes': testAutosizeRemoveAttributes, |
| 2742 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes, | 2768 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes, |
| 2743 'testAPIMethodExistence': testAPIMethodExistence, | 2769 'testAPIMethodExistence': testAPIMethodExistence, |
| 2744 'testChromeExtensionURL': testChromeExtensionURL, | 2770 'testChromeExtensionURL': testChromeExtensionURL, |
| 2745 'testChromeExtensionRelativePath': testChromeExtensionRelativePath, | 2771 'testChromeExtensionRelativePath': testChromeExtensionRelativePath, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2827 'testLoadDataAPI': testLoadDataAPI, | 2853 'testLoadDataAPI': testLoadDataAPI, |
| 2828 'testResizeEvents': testResizeEvents, | 2854 'testResizeEvents': testResizeEvents, |
| 2829 'testPerOriginZoomMode': testPerOriginZoomMode, | 2855 'testPerOriginZoomMode': testPerOriginZoomMode, |
| 2830 'testPerViewZoomMode': testPerViewZoomMode, | 2856 'testPerViewZoomMode': testPerViewZoomMode, |
| 2831 'testDisabledZoomMode': testDisabledZoomMode, | 2857 'testDisabledZoomMode': testDisabledZoomMode, |
| 2832 'testZoomBeforeNavigation': testZoomBeforeNavigation, | 2858 'testZoomBeforeNavigation': testZoomBeforeNavigation, |
| 2833 'testPlugin': testPlugin, | 2859 'testPlugin': testPlugin, |
| 2834 'testGarbageCollect': testGarbageCollect, | 2860 'testGarbageCollect': testGarbageCollect, |
| 2835 'testCloseNewWindowCleanup': testCloseNewWindowCleanup, | 2861 'testCloseNewWindowCleanup': testCloseNewWindowCleanup, |
| 2836 'testFocusWhileFocused': testFocusWhileFocused, | 2862 'testFocusWhileFocused': testFocusWhileFocused, |
| 2837 'testPDFInWebview': testPDFInWebview | 2863 'testPDFInWebview': testPDFInWebview, |
| 2864 'testMailtoLink': testMailtoLink |
| 2838 }; | 2865 }; |
| 2839 | 2866 |
| 2840 onload = function() { | 2867 onload = function() { |
| 2841 chrome.test.getConfig(function(config) { | 2868 chrome.test.getConfig(function(config) { |
| 2842 embedder.setUp_(config); | 2869 embedder.setUp_(config); |
| 2843 chrome.test.sendMessage("Launched"); | 2870 chrome.test.sendMessage("Launched"); |
| 2844 }); | 2871 }); |
| 2845 }; | 2872 }; |
| OLD | NEW |