OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 var LOCAL_FILE_NAME = 'local_frame.html'; |
| 6 var REMOTE_FILE_NAME = 'remote_frame.html'; |
| 7 |
| 8 onmessage = function(e) { |
| 9 chrome.test.assertEq(e.data, 'succeeded'); |
| 10 chrome.test.succeed(); |
| 11 }; |
| 12 |
| 13 var loadIframeContentInSandboxedPage = function(localUrl, remoteUrl) { |
| 14 var sandboxedFrame = document.createElement('iframe'); |
| 15 sandboxedFrame.src = 'sandboxed.html'; |
| 16 sandboxedFrame.onload = function() { |
| 17 sandboxedFrame.contentWindow.postMessage( |
| 18 JSON.stringify(['load', localUrl, remoteUrl]), '*'); |
| 19 sandboxedFrame.onload = null; |
| 20 }; |
| 21 document.body.appendChild(sandboxedFrame); |
| 22 }; |
| 23 |
| 24 onload = function() { |
| 25 chrome.test.getConfig(function(config) { |
| 26 chrome.test.runTests([ |
| 27 // Local frame will succeed loading, but remote frame will fail. |
| 28 function sandboxedFrameTestLocalAndRemote() { |
| 29 var remoteUrl = 'http://localhost:' + config.testServer.port + |
| 30 '/extensions/api_test/sandboxed_pages_csp/' + REMOTE_FILE_NAME; |
| 31 loadIframeContentInSandboxedPage( |
| 32 LOCAL_FILE_NAME, remoteUrl); |
| 33 } |
| 34 ]); |
| 35 }); |
| 36 }; |
OLD | NEW |