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

Side by Side Diff: chrome/test/data/extensions/api_test/executescript/frame_id/test.js

Issue 2541063002: Revert of Remove about:srcdoc url conversion. (Closed)
Patch Set: Created 4 years 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 pass = chrome.test.callbackPass; 5 var pass = chrome.test.callbackPass;
6 var fail = chrome.test.callbackFail; 6 var fail = chrome.test.callbackFail;
7 var assertEq = chrome.test.assertEq; 7 var assertEq = chrome.test.assertEq;
8 var assertTrue = chrome.test.assertTrue; 8 var assertTrue = chrome.test.assertTrue;
9 var relativePath = '/extensions/api_test/executescript/frame_id/frames.html'; 9 var relativePath = '/extensions/api_test/executescript/frame_id/frames.html';
10 var testOrigin = 'http://a.com:PORT'; 10 var testOrigin = 'http://a.com:PORT';
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 matchAboutBlank: true, 140 matchAboutBlank: true,
141 code: 'document.URL' 141 code: 'document.URL'
142 }, 142 },
143 pass(function(results) { 143 pass(function(results) {
144 assertEq(1, results.length); 144 assertEq(1, results.length);
145 assertTrue(matchesAny(results, R_FRAME_SRCDOC)); 145 assertTrue(matchesAny(results, R_FRAME_SRCDOC));
146 })); 146 }));
147 }, 147 },
148 148
149 function executeScriptInSrcdocFrameWithoutMatchAboutBlank() { 149 function executeScriptInSrcdocFrameWithoutMatchAboutBlank() {
150 // TODO(robwu): Why is the origin serialized as "about:blank" instead of
151 // "about:srcdoc"?
150 chrome.tabs.executeScript( 152 chrome.tabs.executeScript(
151 tabId, {frameId: ID_FRAME_SRCDOC, code: 'document.URL'}, 153 tabId, {frameId: ID_FRAME_SRCDOC, code: 'document.URL'},
152 fail( 154 fail(
153 'Cannot access "about:srcdoc" at origin "' + testOrigin + '". ' + 155 'Cannot access "about:blank" at origin "' + testOrigin + '". ' +
154 'Extension must have permission to access the frame\'s origin, ' + 156 'Extension must have permission to access the frame\'s origin, ' +
155 'and matchAboutBlank must be true.')); 157 'and matchAboutBlank must be true.'));
156 }, 158 },
157 159
158 function executeScriptInSrcdocFrameIncludingAllFrames() { 160 function executeScriptInSrcdocFrameIncludingAllFrames() {
159 chrome.tabs.executeScript( 161 chrome.tabs.executeScript(
160 tabId, { 162 tabId, {
161 frameId: ID_FRAME_SRCDOC, 163 frameId: ID_FRAME_SRCDOC,
162 matchAboutBlank: true, 164 matchAboutBlank: true,
163 allFrames: true, 165 allFrames: true,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 function insertCSSInSrcdocFrame() { 276 function insertCSSInSrcdocFrame() {
275 insertCSS( 277 insertCSS(
276 tabId, {frameId: ID_FRAME_SRCDOC, matchAboutBlank: true}, 278 tabId, {frameId: ID_FRAME_SRCDOC, matchAboutBlank: true},
277 pass(function(results) { 279 pass(function(results) {
278 assertEq(1, results.length); 280 assertEq(1, results.length);
279 assertTrue(matchesAny(results, R_FRAME_SRCDOC)); 281 assertTrue(matchesAny(results, R_FRAME_SRCDOC));
280 })); 282 }));
281 }, 283 },
282 284
283 function insertCSSInSrcdocFrameWithoutMatchAboutBlank() { 285 function insertCSSInSrcdocFrameWithoutMatchAboutBlank() {
286 // TODO(robwu): Why is the origin serialized as "about:blank" instead of
287 // "about:srcdoc"?
284 chrome.tabs.insertCSS( 288 chrome.tabs.insertCSS(
285 tabId, {frameId: ID_FRAME_SRCDOC, code: 'body{color:red;}'}, 289 tabId, {frameId: ID_FRAME_SRCDOC, code: 'body{color:red;}'},
286 fail( 290 fail(
287 'Cannot access "about:srcdoc" at origin "' + testOrigin + '". ' + 291 'Cannot access "about:blank" at origin "' + testOrigin + '". ' +
288 'Extension must have permission to access the frame\'s origin, ' + 292 'Extension must have permission to access the frame\'s origin, ' +
289 'and matchAboutBlank must be true.')); 293 'and matchAboutBlank must be true.'));
290 }, 294 },
291 295
292 function insertCSSInSrcdocFrameIncludingAllFrames() { 296 function insertCSSInSrcdocFrameIncludingAllFrames() {
293 insertCSS( 297 insertCSS(
294 tabId, 298 tabId,
295 {frameId: ID_FRAME_SRCDOC, matchAboutBlank: true, allFrames: true}, 299 {frameId: ID_FRAME_SRCDOC, matchAboutBlank: true, allFrames: true},
296 pass(function(results) { 300 pass(function(results) {
297 assertEq(1, results.length); 301 assertEq(1, results.length);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 assertEq( 374 assertEq(
371 'Invalid value for argument 2. Property \'frameId\': ' + 375 'Invalid value for argument 2. Property \'frameId\': ' +
372 'Value must not be less than 0.', 376 'Value must not be less than 0.',
373 e.message); 377 e.message);
374 chrome.test.succeed(); 378 chrome.test.succeed();
375 } 379 }
376 }, 380 },
377 381
378 ]); 382 ]);
379 } 383 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/md_settings_ui.cc ('k') | components/dom_distiller/content/browser/distillability_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698