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

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

Issue 27408004: <webview>: Resolve relative paths as chrome-extension: URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor + addressed creis' comments Created 7 years, 1 month 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 unified diff | Download patch
OLDNEW
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 webview.addEventListener('loadabort', function(e) { 309 webview.addEventListener('loadabort', function(e) {
310 embedder.test.fail(); 310 embedder.test.fail();
311 }); 311 });
312 webview.addEventListener('loadstop', function(e) { 312 webview.addEventListener('loadstop', function(e) {
313 embedder.test.succeed(); 313 embedder.test.succeed();
314 }); 314 });
315 webview.setAttribute('src', localResource); 315 webview.setAttribute('src', localResource);
316 document.body.appendChild(webview); 316 document.body.appendChild(webview);
317 } 317 }
318 318
319 // This test verifies that the loadstop event fires when loading a webview
320 // accessible resource from a partition that is privileged if the src URL
321 // is not fully qualified.
322 function testChromeExtensionRelativePath() {
323 var webview = document.createElement('webview');
324 // foobar is a privileged partition according to the manifest file.
325 webview.partition = 'foobar';
326 webview.addEventListener('loadabort', function(e) {
327 embedder.test.fail();
328 });
329 webview.addEventListener('loadstop', function(e) {
330 embedder.test.succeed();
331 });
332 webview.setAttribute('src', 'guest.html');
333 document.body.appendChild(webview);
334 }
335
319 // This tests verifies that webview fires a loadabort event instead of crashing 336 // This tests verifies that webview fires a loadabort event instead of crashing
320 // the browser if we attempt to navigate to a chrome-extension: URL with an 337 // the browser if we attempt to navigate to a chrome-extension: URL with an
321 // extension ID that does not exist. 338 // extension ID that does not exist.
322 function testInvalidChromeExtensionURL() { 339 function testInvalidChromeExtensionURL() {
323 var invalidResource = 'chrome-extension://abc123/guest.html'; 340 var invalidResource = 'chrome-extension://abc123/guest.html';
324 var webview = document.createElement('webview'); 341 var webview = document.createElement('webview');
325 // foobar is a privileged partition according to the manifest file. 342 // foobar is a privileged partition according to the manifest file.
326 webview.partition = 'foobar'; 343 webview.partition = 'foobar';
327 webview.addEventListener('loadabort', function(e) { 344 webview.addEventListener('loadabort', function(e) {
328 embedder.test.succeed(); 345 embedder.test.succeed();
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 document.body.appendChild(webview); 1139 document.body.appendChild(webview);
1123 } 1140 }
1124 1141
1125 embedder.test.testList = { 1142 embedder.test.testList = {
1126 'testAutosizeAfterNavigation': testAutosizeAfterNavigation, 1143 'testAutosizeAfterNavigation': testAutosizeAfterNavigation,
1127 'testAutosizeBeforeNavigation': testAutosizeBeforeNavigation, 1144 'testAutosizeBeforeNavigation': testAutosizeBeforeNavigation,
1128 'testAutosizeRemoveAttributes': testAutosizeRemoveAttributes, 1145 'testAutosizeRemoveAttributes': testAutosizeRemoveAttributes,
1129 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes, 1146 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes,
1130 'testAPIMethodExistence': testAPIMethodExistence, 1147 'testAPIMethodExistence': testAPIMethodExistence,
1131 'testChromeExtensionURL': testChromeExtensionURL, 1148 'testChromeExtensionURL': testChromeExtensionURL,
1149 'testChromeExtensionRelativePath': testChromeExtensionRelativePath,
1132 'testInvalidChromeExtensionURL': testInvalidChromeExtensionURL, 1150 'testInvalidChromeExtensionURL': testInvalidChromeExtensionURL,
1133 'testWebRequestAPIExistence': testWebRequestAPIExistence, 1151 'testWebRequestAPIExistence': testWebRequestAPIExistence,
1134 'testEventName': testEventName, 1152 'testEventName': testEventName,
1135 'testOnEventProperties': testOnEventProperties, 1153 'testOnEventProperties': testOnEventProperties,
1136 'testLoadProgressEvent': testLoadProgressEvent, 1154 'testLoadProgressEvent': testLoadProgressEvent,
1137 'testDestroyOnEventListener': testDestroyOnEventListener, 1155 'testDestroyOnEventListener': testDestroyOnEventListener,
1138 'testCannotMutateEventName': testCannotMutateEventName, 1156 'testCannotMutateEventName': testCannotMutateEventName,
1139 'testPartitionRaisesException': testPartitionRaisesException, 1157 'testPartitionRaisesException': testPartitionRaisesException,
1140 'testExecuteScriptFail': testExecuteScriptFail, 1158 'testExecuteScriptFail': testExecuteScriptFail,
1141 'testExecuteScript': testExecuteScript, 1159 'testExecuteScript': testExecuteScript,
(...skipping 29 matching lines...) Expand all
1171 'testRemoveWebviewAfterNavigation': testRemoveWebviewAfterNavigation, 1189 'testRemoveWebviewAfterNavigation': testRemoveWebviewAfterNavigation,
1172 'testResizeWebviewResizesContent': testResizeWebviewResizesContent 1190 'testResizeWebviewResizesContent': testResizeWebviewResizesContent
1173 }; 1191 };
1174 1192
1175 onload = function() { 1193 onload = function() {
1176 chrome.test.getConfig(function(config) { 1194 chrome.test.getConfig(function(config) {
1177 embedder.setUp_(config); 1195 embedder.setUp_(config);
1178 chrome.test.sendMessage("Launched"); 1196 chrome.test.sendMessage("Launched");
1179 }); 1197 });
1180 }; 1198 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698