| OLD | NEW |
| 1 <script> | 1 <script> |
| 2 var normalWindow, normalTab; | 2 var normalWindow, normalTab; |
| 3 var incognitoWindow, incognitoTab; | 3 var incognitoWindow, incognitoTab; |
| 4 | 4 |
| 5 var pass = chrome.test.callbackPass; | 5 var pass = chrome.test.callbackPass; |
| 6 var fail = chrome.test.callbackFail; |
| 6 var assertEq = chrome.test.assertEq; | 7 var assertEq = chrome.test.assertEq; |
| 7 var assertTrue = chrome.test.assertTrue; | 8 var assertTrue = chrome.test.assertTrue; |
| 8 | 9 |
| 9 chrome.test.getConfig(function(config) { | 10 chrome.test.getConfig(function(config) { |
| 10 chrome.test.runTests([ | 11 chrome.test.runTests([ |
| 11 function setupWindows() { | 12 function setupWindows() { |
| 12 // The test harness should have set us up with 2 windows: 1 incognito | 13 // The test harness should have set us up with 2 windows: 1 incognito |
| 13 // and 1 regular. Verify that we can see both when we ask for it. | 14 // and 1 regular. Verify that we can see both when we ask for it. |
| 14 chrome.windows.getAll({populate: true}, pass(function(windows) { | 15 chrome.windows.getAll({populate: true}, pass(function(windows) { |
| 15 assertEq(2, windows.length); | 16 assertEq(2, windows.length); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 pass(function(tab) { | 101 pass(function(tab) { |
| 101 chrome.tabs.executeScript(tab.id, | 102 chrome.tabs.executeScript(tab.id, |
| 102 {code: 'document.title = chrome.extension.inIncognitoContext'}, | 103 {code: 'document.title = chrome.extension.inIncognitoContext'}, |
| 103 pass(function() { | 104 pass(function() { |
| 104 assertEq(undefined, chrome.extension.lastError); | 105 assertEq(undefined, chrome.extension.lastError); |
| 105 chrome.tabs.get(tab.id, pass(function(tab) { | 106 chrome.tabs.get(tab.id, pass(function(tab) { |
| 106 assertEq("false", tab.title); | 107 assertEq("false", tab.title); |
| 107 })); | 108 })); |
| 108 })); | 109 })); |
| 109 })); | 110 })); |
| 111 }, |
| 112 |
| 113 // Tests that extensions can't move tabs between incognito and |
| 114 // non-incognito windows. |
| 115 function moveTabBetweenProfiles() { |
| 116 var errorMsg = "Tabs can only be moved between " + |
| 117 "windows in the same profile."; |
| 118 |
| 119 // Create a tab in the non-incognito window... |
| 120 chrome.tabs.create({windowId: normalWindow.id, url: 'about:blank'}, |
| 121 pass(function(tab) { |
| 122 // ... and then try to move it to the incognito window. |
| 123 chrome.tabs.move(tab.id, |
| 124 {windowId: incognitoWindow.id, index: 0}, fail(errorMsg)); |
| 125 })); |
| 110 } | 126 } |
| 111 ]); | 127 ]); |
| 112 }); | 128 }); |
| 113 | 129 |
| 114 </script> | 130 </script> |
| OLD | NEW |