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

Side by Side Diff: chrome/test/data/extensions/api_test/sandboxed_pages_csp/main.js

Issue 2775953002: Some cleanup of app and extension CSP tests.
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 LOCAL_FILE_NAME = 'local_frame.html'; 5 var LOCAL_FILE_NAME = 'local_frame.html';
6 var REMOTE_FILE_NAME = 'remote_frame.html'; 6 var REMOTE_FILE_NAME = 'remote_frame.html';
7 7
8 onmessage = function(e) { 8 onmessage = function(e) {
9 chrome.test.assertEq(e.data, 'succeeded'); 9 chrome.test.assertEq('succeeded', e.data);
10 chrome.test.succeed(); 10 chrome.test.succeed();
11 }; 11 };
12 12
13 var loadIframeContentInSandboxedPage = function(localUrl, remoteUrl) { 13 var loadIframeContentInSandboxedPage = function(localUrl, remoteUrl) {
14 var sandboxedFrame = document.createElement('iframe'); 14 var sandboxedFrame = document.createElement('iframe');
15 sandboxedFrame.src = 'sandboxed.html'; 15 sandboxedFrame.src = 'sandboxed.html';
16 sandboxedFrame.onload = function() { 16 sandboxedFrame.onload = function() {
17 sandboxedFrame.contentWindow.postMessage( 17 sandboxedFrame.contentWindow.postMessage(
18 JSON.stringify(['load', localUrl, remoteUrl]), '*'); 18 JSON.stringify(['load', localUrl, remoteUrl]), '*');
19 sandboxedFrame.onload = null; 19 sandboxedFrame.onload = null;
20 }; 20 };
21 document.body.appendChild(sandboxedFrame); 21 document.body.appendChild(sandboxedFrame);
22 }; 22 };
23 23
24 onload = function() { 24 onload = function() {
25 chrome.test.getConfig(function(config) { 25 chrome.test.getConfig(function(config) {
26 chrome.test.runTests([ 26 chrome.test.runTests([
27 // Local frame will succeed loading, but remote frame will fail. 27 // Local frame will succeed loading, but remote frame will fail.
28 function sandboxedFrameTestLocalAndRemote() { 28 function sandboxedFrameTestLocalAndRemote() {
29 var remoteUrl = 'http://localhost:' + config.testServer.port + 29 var remoteUrl = 'http://localhost:' + config.testServer.port +
30 '/extensions/api_test/sandboxed_pages_csp/' + REMOTE_FILE_NAME; 30 '/extensions/api_test/sandboxed_pages_csp/' + REMOTE_FILE_NAME;
31 loadIframeContentInSandboxedPage( 31 loadIframeContentInSandboxedPage(
32 LOCAL_FILE_NAME, remoteUrl); 32 LOCAL_FILE_NAME, remoteUrl);
33 } 33 }
34 ]); 34 ]);
35 }); 35 });
36 }; 36 };
OLDNEW
« no previous file with comments | « chrome/browser/apps/app_browsertest.cc ('k') | chrome/test/data/extensions/api_test/sandboxed_pages_csp/remote_frame.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698