| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 normalWindow, normalTab; | 5 var normalWindow, normalTab; |
| 6 var incognitoWindow, incognitoTab; | 6 var incognitoWindow, incognitoTab; |
| 7 | 7 |
| 8 var pass = chrome.test.callbackPass; | 8 var pass = chrome.test.callbackPass; |
| 9 var fail = chrome.test.callbackFail; | 9 var fail = chrome.test.callbackFail; |
| 10 var assertEq = chrome.test.assertEq; | 10 var assertEq = chrome.test.assertEq; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 chrome.tabs.remove(tab.id, pass()); | 76 chrome.tabs.remove(tab.id, pass()); |
| 77 })); | 77 })); |
| 78 })); | 78 })); |
| 79 }, | 79 }, |
| 80 | 80 |
| 81 // Tests content script injection to verify that the script can tell its | 81 // Tests content script injection to verify that the script can tell its |
| 82 // in incongnito. | 82 // in incongnito. |
| 83 function contentScriptTestIncognito() { | 83 function contentScriptTestIncognito() { |
| 84 assertTrue(!chrome.extension.inIncognitoContext); | 84 assertTrue(!chrome.extension.inIncognitoContext); |
| 85 | 85 |
| 86 var testUrl = "http://localhost:PORT/files/extensions/test_file.html" | 86 var testUrl = "http://localhost:PORT/extensions/test_file.html" |
| 87 .replace(/PORT/, config.testServer.port); | 87 .replace(/PORT/, config.testServer.port); |
| 88 | 88 |
| 89 // Test that chrome.extension.inIncognitoTab is true for incognito tabs. | 89 // Test that chrome.extension.inIncognitoTab is true for incognito tabs. |
| 90 chrome.tabs.create({windowId: incognitoWindow.id, url: testUrl}, | 90 chrome.tabs.create({windowId: incognitoWindow.id, url: testUrl}, |
| 91 pass(function(tab) { | 91 pass(function(tab) { |
| 92 chrome.tabs.executeScript(tab.id, | 92 chrome.tabs.executeScript(tab.id, |
| 93 {code: 'document.title = chrome.extension.inIncognitoContext'}, | 93 {code: 'document.title = chrome.extension.inIncognitoContext'}, |
| 94 pass(function() { | 94 pass(function() { |
| 95 assertEq(undefined, chrome.runtime.lastError); | 95 assertEq(undefined, chrome.runtime.lastError); |
| 96 chrome.tabs.get(tab.id, pass(function(tab) { | 96 chrome.tabs.get(tab.id, pass(function(tab) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 122 // Create a tab in the non-incognito window... | 122 // Create a tab in the non-incognito window... |
| 123 chrome.tabs.create({windowId: normalWindow.id, url: 'about:blank'}, | 123 chrome.tabs.create({windowId: normalWindow.id, url: 'about:blank'}, |
| 124 pass(function(tab) { | 124 pass(function(tab) { |
| 125 // ... and then try to move it to the incognito window. | 125 // ... and then try to move it to the incognito window. |
| 126 chrome.tabs.move(tab.id, | 126 chrome.tabs.move(tab.id, |
| 127 {windowId: incognitoWindow.id, index: 0}, fail(errorMsg)); | 127 {windowId: incognitoWindow.id, index: 0}, fail(errorMsg)); |
| 128 })); | 128 })); |
| 129 } | 129 } |
| 130 ]); | 130 ]); |
| 131 }); | 131 }); |
| OLD | NEW |