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 2941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2952 // 'about:blank'. | 2952 // 'about:blank'. |
2953 embedder.test.assertFalse(webview.src == 'about:blank'); | 2953 embedder.test.assertFalse(webview.src == 'about:blank'); |
2954 embedder.test.succeed(); | 2954 embedder.test.succeed(); |
2955 }; | 2955 }; |
2956 webview.executeScript({code:'document.getElementById("mailto").click()'}); | 2956 webview.executeScript({code:'document.getElementById("mailto").click()'}); |
2957 }; | 2957 }; |
2958 | 2958 |
2959 document.body.appendChild(webview); | 2959 document.body.appendChild(webview); |
2960 } | 2960 } |
2961 | 2961 |
| 2962 // This test verifies that an embedder can navigate a WebView to a blob URL it |
| 2963 // creates. |
| 2964 function testBlobURL() { |
| 2965 var webview = new WebView(); |
| 2966 var blob = new Blob(['<html><body>Blob content</body></html>'], |
| 2967 {type: 'text/html'}); |
| 2968 var blobURL = URL.createObjectURL(blob); |
| 2969 webview.src = blobURL; |
| 2970 |
| 2971 webview.onloadabort = function() { |
| 2972 // The blob: URL load should not trigger a loadabort. |
| 2973 window.console.log('Blob URL load was aborted.'); |
| 2974 embedder.test.fail(); |
| 2975 }; |
| 2976 webview.onloadstop = function() { |
| 2977 embedder.test.assertTrue(webview.src == blobURL); |
| 2978 embedder.test.succeed(); |
| 2979 }; |
| 2980 |
| 2981 document.body.appendChild(webview); |
| 2982 } |
| 2983 |
2962 // This test navigates an unattached guest to 'about:blank', then it makes a | 2984 // This test navigates an unattached guest to 'about:blank', then it makes a |
2963 // renderer/ navigation to a URL that results in a server side redirect. In the | 2985 // renderer/ navigation to a URL that results in a server side redirect. In the |
2964 // end we verify that the redirected URL loads in the guest properly. | 2986 // end we verify that the redirected URL loads in the guest properly. |
2965 function testRendererNavigationRedirectWhileUnattached() { | 2987 function testRendererNavigationRedirectWhileUnattached() { |
2966 var webview = document.createElement('webview'); | 2988 var webview = document.createElement('webview'); |
2967 // So that |webview| is unattached, but can navigate. | 2989 // So that |webview| is unattached, but can navigate. |
2968 webview.style.display = 'none'; | 2990 webview.style.display = 'none'; |
2969 | 2991 |
2970 var seenRedirectURLCommit = false; | 2992 var seenRedirectURLCommit = false; |
2971 var seenRedirectLoadStop = false; | 2993 var seenRedirectLoadStop = false; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3108 'testPerViewZoomMode': testPerViewZoomMode, | 3130 'testPerViewZoomMode': testPerViewZoomMode, |
3109 'testDisabledZoomMode': testDisabledZoomMode, | 3131 'testDisabledZoomMode': testDisabledZoomMode, |
3110 'testZoomBeforeNavigation': testZoomBeforeNavigation, | 3132 'testZoomBeforeNavigation': testZoomBeforeNavigation, |
3111 'testPlugin': testPlugin, | 3133 'testPlugin': testPlugin, |
3112 'testGarbageCollect': testGarbageCollect, | 3134 'testGarbageCollect': testGarbageCollect, |
3113 'testCloseNewWindowCleanup': testCloseNewWindowCleanup, | 3135 'testCloseNewWindowCleanup': testCloseNewWindowCleanup, |
3114 'testFocusWhileFocused': testFocusWhileFocused, | 3136 'testFocusWhileFocused': testFocusWhileFocused, |
3115 'testPDFInWebview': testPDFInWebview, | 3137 'testPDFInWebview': testPDFInWebview, |
3116 'testMailtoLink': testMailtoLink, | 3138 'testMailtoLink': testMailtoLink, |
3117 'testRendererNavigationRedirectWhileUnattached': | 3139 'testRendererNavigationRedirectWhileUnattached': |
3118 testRendererNavigationRedirectWhileUnattached | 3140 testRendererNavigationRedirectWhileUnattached, |
| 3141 'testBlobURL': testBlobURL |
3119 }; | 3142 }; |
3120 | 3143 |
3121 onload = function() { | 3144 onload = function() { |
3122 chrome.test.getConfig(function(config) { | 3145 chrome.test.getConfig(function(config) { |
3123 embedder.setUp_(config); | 3146 embedder.setUp_(config); |
3124 chrome.test.sendMessage("Launched"); | 3147 chrome.test.sendMessage("Launched"); |
3125 }); | 3148 }); |
3126 }; | 3149 }; |
OLD | NEW |