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

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

Issue 19783003: Rewrite ExtensionApiTest.SandboxedPages to catch exceptions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/sandboxed_pages/sandboxed.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 secret = 'main_window_secret'; 5 var secret = 'main_window_secret';
6 6
7 onmessage = function(event) { 7 onmessage = function(event) {
8 var sandboxedWindow = event.source; 8 var sandboxedWindow = event.source;
9 // They can't read our secret. 9 // They can't read our secret.
10 chrome.test.assertEq(undefined, event.data); 10 chrome.test.assertEq(undefined, event.data);
11 11
12 // And we can't read theirs. 12 // And we can't read theirs.
13 chrome.test.assertEq(undefined, sandboxedWindow.secret); 13 sandboxedWindowSecret = undefined;
14 try {
15 sandboxedWindowSecret = sandboxedWindow.secret;
16 } catch (e) {}
17 chrome.test.assertEq(undefined, sandboxedWindowSecret);
14 18
15 chrome.test.succeed(); 19 chrome.test.succeed();
16 }; 20 };
17 21
18 onload = function() { 22 onload = function() {
19 chrome.test.runTests([ 23 chrome.test.runTests([
20 function sandboxedWindow() { 24 function sandboxedWindow() {
21 var w = window.open('sandboxed.html'); 25 var w = window.open('sandboxed.html');
22 }, 26 },
23 27
24 function sandboxedFrame() { 28 function sandboxedFrame() {
25 var iframe = document.createElement('iframe'); 29 var iframe = document.createElement('iframe');
26 iframe.src = 'sandboxed.html'; 30 iframe.src = 'sandboxed.html';
27 document.body.appendChild(iframe); 31 document.body.appendChild(iframe);
28 } 32 }
29 ]); 33 ]);
30 }; 34 };
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/sandboxed_pages/sandboxed.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698