| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 function remove() { | 74 function remove() { |
| 75 chrome.tabs.remove(moveTabIds["d"], pass(function() { | 75 chrome.tabs.remove(moveTabIds["d"], pass(function() { |
| 76 chrome.tabs.getAllInWindow(secondWindowId, | 76 chrome.tabs.getAllInWindow(secondWindowId, |
| 77 pass(function(tabs) { | 77 pass(function(tabs) { |
| 78 assertEq(2, tabs.length); | 78 assertEq(2, tabs.length); |
| 79 assertEq(pageUrl("b"), tabs[0].url); | 79 assertEq(pageUrl("b"), tabs[0].url); |
| 80 assertEq("chrome://newtab/", tabs[1].url); | 80 assertEq("chrome://newtab/", tabs[1].url); |
| 81 })); | 81 })); |
| 82 })); | 82 })); |
| 83 }, |
| 84 |
| 85 // Make sure we don't crash when the index is out of range. |
| 86 function moveToInvalidTab() { |
| 87 var error_msg = "Invalid value for argument 2. Property 'index': " + |
| 88 "Value must not be less than 0."; |
| 89 try { |
| 90 chrome.tabs.move(moveTabIds['b'], {index: -1}, function(tab) { |
| 91 chrome.test.fail("Moved a tab to an invalid index"); |
| 92 }); |
| 93 } catch (e) { |
| 94 assertEq(error_msg, e.message); |
| 95 } |
| 96 chrome.tabs.move(moveTabIds['b'], {index: 10000}, pass(function(tabB) { |
| 97 assertEq(1, tabB.index); |
| 98 })); |
| 83 } | 99 } |
| 84 ]); | 100 ]); |
| 85 </script> | 101 </script> |
| OLD | NEW |