| OLD | NEW |
| 1 <script src="tabs_util.js"></script> | 1 <script src="tabs_util.js"></script> |
| 2 | 2 |
| 3 <script> | 3 <script> |
| 4 var firstWindowId; | 4 var firstWindowId; |
| 5 var secondWindowId; | 5 var secondWindowId; |
| 6 var moveTabIds = {}; | 6 var moveTabIds = {}; |
| 7 | 7 |
| 8 chrome.test.runTests([ | 8 chrome.test.runTests([ |
| 9 // Do a series of moves so that we get the following | 9 // Do a series of moves so that we get the following |
| 10 // | 10 // |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 chrome.tabs.move(moveTabIds['e'], {"index": 2}, | 62 chrome.tabs.move(moveTabIds['e'], {"index": 2}, |
| 63 pass(function(tabE) { | 63 pass(function(tabE) { |
| 64 chrome.test.assertEq(2, tabE.index); | 64 chrome.test.assertEq(2, tabE.index); |
| 65 chrome.tabs.move(moveTabIds['d'], {"windowId": secondWindowId, | 65 chrome.tabs.move(moveTabIds['d'], {"windowId": secondWindowId, |
| 66 "index": 2}, pass(function(tabD) { | 66 "index": 2}, pass(function(tabD) { |
| 67 chrome.test.assertEq(2, tabD.index); | 67 chrome.test.assertEq(2, tabD.index); |
| 68 checkMoveResults(); | 68 checkMoveResults(); |
| 69 })); | 69 })); |
| 70 })); | 70 })); |
| 71 })); | 71 })); |
| 72 |
| 73 // Check that the browser doesn't segfault on a negative index |
| 74 // or an out of range integer (BUG=53990). |
| 75 chrome.tabs.getAllInWindow(firstWindowId, pass(function(tabs) { |
| 76 lastTab = tabs.pop() |
| 77 try { |
| 78 chrome.tabs.move(lastTab.id, {'windowId': firstWindowId, 'index': -1}); |
| 79 } |
| 80 catch(err) { |
| 81 // Always generates an exception, but it doesn't need to be handled |
| 82 // because it's tested in js_schema_test.js. |
| 83 } |
| 84 try { |
| 85 chrome.tabs.move(lastTab.id,{'index':1E10}); |
| 86 } |
| 87 catch(err) { |
| 88 // Also doesn't need to be handled. |
| 89 } |
| 90 })); |
| 72 }, | 91 }, |
| 73 | 92 |
| 74 function remove() { | 93 function remove() { |
| 75 chrome.tabs.remove(moveTabIds["d"], pass(function() { | 94 chrome.tabs.remove(moveTabIds["d"], pass(function() { |
| 76 chrome.tabs.getAllInWindow(secondWindowId, | 95 chrome.tabs.getAllInWindow(secondWindowId, |
| 77 pass(function(tabs) { | 96 pass(function(tabs) { |
| 78 assertEq(2, tabs.length); | 97 assertEq(2, tabs.length); |
| 79 assertEq(pageUrl("b"), tabs[0].url); | 98 assertEq(pageUrl("b"), tabs[0].url); |
| 80 assertEq("chrome://newtab/", tabs[1].url); | 99 assertEq("chrome://newtab/", tabs[1].url); |
| 81 })); | 100 })); |
| 82 })); | 101 })); |
| 83 } | 102 } |
| 84 ]); | 103 ]); |
| 85 </script> | 104 </script> |
| OLD | NEW |