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

Side by Side Diff: chrome/test/data/extensions/platform_apps/restrictions/test.js

Issue 10443047: Disable synchronous XMLHttpRequests in platform app documents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
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 assertEq = chrome.test.assertEq; 5 var assertEq = chrome.test.assertEq;
6 var fail = chrome.test.fail; 6 var fail = chrome.test.fail;
7 var succeed = chrome.test.succeed; 7 var succeed = chrome.test.succeed;
8 8
9 var error = "Not available for platform apps."; 9 var DEFAULT_EXPECTED_ERROR = "Not available for platform apps.";
10 10
11 function assertThrowsError(method) { 11 function assertThrowsError(method, opt_expectedError) {
12 try { 12 try {
13 method(); 13 method();
14 fail("error not thrown"); 14 fail("error not thrown");
15 } catch (e) { 15 } catch (e) {
16 assertEq(e, error); 16 assertEq(e.message || e, opt_expectedError || DEFAULT_EXPECTED_ERROR);
17 } 17 }
18 } 18 }
19 19
20 chrome.test.runTests([ 20 chrome.test.runTests([
21 function testDocumentOpen() { 21 function testDocumentOpen() {
22 assertThrowsError(document.open); 22 assertThrowsError(document.open);
23 succeed(); 23 succeed();
24 }, 24 },
25 25
26 function testDocumentClose() { 26 function testDocumentClose() {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 function testBars() { 106 function testBars() {
107 var bars = ['locationbar', 'menubar', 'personalbar', 107 var bars = ['locationbar', 'menubar', 'personalbar',
108 'scrollbars', 'statusbar', 'toolbar']; 108 'scrollbars', 'statusbar', 'toolbar'];
109 for (var x = 0; x < bars.length; x++) { 109 for (var x = 0; x < bars.length; x++) {
110 assertThrowsError(function() { 110 assertThrowsError(function() {
111 var visible = this[bars[x]].visible; 111 var visible = this[bars[x]].visible;
112 visible = window[bars[x]].visible; 112 visible = window[bars[x]].visible;
113 }); 113 });
114 } 114 }
115 succeed(); 115 succeed();
116 },
117
118 function testSyncXhr() {
119 var xhr = new XMLHttpRequest();
120 assertThrowsError(function() {
121 xhr.open('GET', 'data:should not load', false);
122 }, 'INVALID_ACCESS_ERR: DOM Exception 15');
123 succeed();
116 } 124 }
117 ]); 125 ]);
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_webkit_preferences.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698