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

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

Issue 2886633002: [Extension Bindings] Update ExecuteScriptApiTest.ExecuteScriptByFrameId (Closed)
Patch Set: add comments Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 }, 237 },
238 238
239 function executeScriptWithNegativeFrameId() { 239 function executeScriptWithNegativeFrameId() {
240 try { 240 try {
241 chrome.tabs.executeScript( 241 chrome.tabs.executeScript(
242 tabId, {frameId: -1, code: 'document.URL'}, function() { 242 tabId, {frameId: -1, code: 'document.URL'}, function() {
243 chrome.test.fail( 243 chrome.test.fail(
244 'executeScript should never have been executed!'); 244 'executeScript should never have been executed!');
245 }); 245 });
246 } catch (e) { 246 } catch (e) {
247 assertEq( 247 assertTrue(
248 'Invalid value for argument 2. Property \'frameId\': ' + 248 // JS-based bindings.
249 'Value must not be less than 0.', 249 e.message == 'Invalid value for argument 2. Property \'frameId\':' +
250 ' Value must not be less than 0.' ||
251 // Native bindings.
252 e.message == 'Error in invocation of tabs.executeScript(' +
253 'optional integer tabId, ' +
254 'extensionTypes.InjectDetails details, ' +
255 'optional function callback): Error at parameter ' +
256 '\'details\': Error at property \'frameId\': ' +
257 'Value must be at least 0.',
250 e.message); 258 e.message);
251 chrome.test.succeed(); 259 chrome.test.succeed();
252 } 260 }
253 }, 261 },
254 262
255 function insertCSSInTopFrame() { 263 function insertCSSInTopFrame() {
256 insertCSS(tabId, {frameId: 0}, pass(function(results) { 264 insertCSS(tabId, {frameId: 0}, pass(function(results) {
257 assertEq(1, results.length); 265 assertEq(1, results.length);
258 assertTrue(matchesAny(results, R_FRAME_TOP)); 266 assertTrue(matchesAny(results, R_FRAME_TOP));
259 })); 267 }));
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 fail('No frame with id 999999999 in tab ' + tabId + '.')); 368 fail('No frame with id 999999999 in tab ' + tabId + '.'));
361 }, 369 },
362 370
363 function insertCSSWithNegativeFrameId() { 371 function insertCSSWithNegativeFrameId() {
364 try { 372 try {
365 chrome.tabs.insertCSS( 373 chrome.tabs.insertCSS(
366 tabId, {frameId: -1, code: 'body{color:red}'}, function() { 374 tabId, {frameId: -1, code: 'body{color:red}'}, function() {
367 chrome.test.fail('insertCSS should never have been executed!'); 375 chrome.test.fail('insertCSS should never have been executed!');
368 }); 376 });
369 } catch (e) { 377 } catch (e) {
370 assertEq( 378 assertTrue(
371 'Invalid value for argument 2. Property \'frameId\': ' + 379 // JS-based bindings.
372 'Value must not be less than 0.', 380 e.message == 'Invalid value for argument 2. Property \'frameId\':' +
381 ' Value must not be less than 0.' ||
382 // Native bindings.
383 e.message == 'Error in invocation of tabs.insertCSS(' +
384 'optional integer tabId, ' +
385 'extensionTypes.InjectDetails details, ' +
386 'optional function callback): Error at parameter ' +
387 '\'details\': Error at property \'frameId\': ' +
388 'Value must be at least 0.',
373 e.message); 389 e.message);
374 chrome.test.succeed(); 390 chrome.test.succeed();
375 } 391 }
376 }, 392 },
377 393
378 ]); 394 ]);
379 } 395 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698