Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 e.message == 'Invalid value for argument 2. Property \'frameId\':' + |
|
lazyboy
2017/05/20 01:51:54
Here and below: add a comment saying which binding
Devlin
2017/05/23 22:29:56
Done.
| |
| 249 'Value must not be less than 0.', | 249 ' Value must not be less than 0.' || |
| 250 e.message == 'Error in invocation of tabs.executeScript(' + | |
| 251 'optional integer tabId, ' + | |
| 252 'extensionTypes.InjectDetails details, ' + | |
| 253 'optional function callback): Error at parameter ' + | |
| 254 '\'details\': Error at property \'frameId\': ' + | |
| 255 'Value must be at least 0.', | |
| 250 e.message); | 256 e.message); |
| 251 chrome.test.succeed(); | 257 chrome.test.succeed(); |
| 252 } | 258 } |
| 253 }, | 259 }, |
| 254 | 260 |
| 255 function insertCSSInTopFrame() { | 261 function insertCSSInTopFrame() { |
| 256 insertCSS(tabId, {frameId: 0}, pass(function(results) { | 262 insertCSS(tabId, {frameId: 0}, pass(function(results) { |
| 257 assertEq(1, results.length); | 263 assertEq(1, results.length); |
| 258 assertTrue(matchesAny(results, R_FRAME_TOP)); | 264 assertTrue(matchesAny(results, R_FRAME_TOP)); |
| 259 })); | 265 })); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 fail('No frame with id 999999999 in tab ' + tabId + '.')); | 366 fail('No frame with id 999999999 in tab ' + tabId + '.')); |
| 361 }, | 367 }, |
| 362 | 368 |
| 363 function insertCSSWithNegativeFrameId() { | 369 function insertCSSWithNegativeFrameId() { |
| 364 try { | 370 try { |
| 365 chrome.tabs.insertCSS( | 371 chrome.tabs.insertCSS( |
| 366 tabId, {frameId: -1, code: 'body{color:red}'}, function() { | 372 tabId, {frameId: -1, code: 'body{color:red}'}, function() { |
| 367 chrome.test.fail('insertCSS should never have been executed!'); | 373 chrome.test.fail('insertCSS should never have been executed!'); |
| 368 }); | 374 }); |
| 369 } catch (e) { | 375 } catch (e) { |
| 370 assertEq( | 376 assertTrue( |
| 371 'Invalid value for argument 2. Property \'frameId\': ' + | 377 e.message == 'Invalid value for argument 2. Property \'frameId\':' + |
| 372 'Value must not be less than 0.', | 378 ' Value must not be less than 0.' || |
| 379 e.message == 'Error in invocation of tabs.insertCSS(' + | |
| 380 'optional integer tabId, ' + | |
| 381 'extensionTypes.InjectDetails details, ' + | |
| 382 'optional function callback): Error at parameter ' + | |
| 383 '\'details\': Error at property \'frameId\': ' + | |
| 384 'Value must be at least 0.', | |
| 373 e.message); | 385 e.message); |
| 374 chrome.test.succeed(); | 386 chrome.test.succeed(); |
| 375 } | 387 } |
| 376 }, | 388 }, |
| 377 | 389 |
| 378 ]); | 390 ]); |
| 379 } | 391 } |
| OLD | NEW |