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

Side by Side Diff: chrome/test/data/extensions/api_test/tabs/basics/move.html

Issue 7787004: Fix crash when calling chrome.tabs.move({index:-1}). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/resources/json_schema.js ('k') | 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 <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
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>
OLDNEW
« no previous file with comments | « chrome/renderer/resources/json_schema.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698