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 pass = chrome.test.callbackPass; | 5 var pass = chrome.test.callbackPass; |
6 var assertEq = chrome.test.assertEq; | 6 var assertEq = chrome.test.assertEq; |
7 var assertTrue = chrome.test.assertTrue; | 7 var assertTrue = chrome.test.assertTrue; |
8 | 8 |
9 var win, tab; | 9 var win, tab; |
10 var inIncognitoContext = chrome.extension.inIncognitoContext; | 10 var inIncognitoContext = chrome.extension.inIncognitoContext; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 done(); | 81 done(); |
82 }); | 82 }); |
83 | 83 |
84 // Update our tab. | 84 // Update our tab. |
85 chrome.tabs.update(tab.id, {"url": newUrl}, pass()); | 85 chrome.tabs.update(tab.id, {"url": newUrl}, pass()); |
86 }, | 86 }, |
87 | 87 |
88 // Tests content script injection to verify that the script can tell its | 88 // Tests content script injection to verify that the script can tell its |
89 // in incongnito. | 89 // in incongnito. |
90 function contentScriptTestIncognito() { | 90 function contentScriptTestIncognito() { |
91 var testUrl = "http://localhost:PORT/files/extensions/test_file.html" | 91 var testUrl = "http://localhost:PORT/extensions/test_file.html" |
92 .replace(/PORT/, config.testServer.port); | 92 .replace(/PORT/, config.testServer.port); |
93 | 93 |
94 // Test that chrome.extension.inIncognitoContext is true for incognito | 94 // Test that chrome.extension.inIncognitoContext is true for incognito |
95 // tabs. | 95 // tabs. |
96 chrome.tabs.create({windowId: win.id, url: testUrl}, | 96 chrome.tabs.create({windowId: win.id, url: testUrl}, |
97 pass(function(tab) { | 97 pass(function(tab) { |
98 chrome.tabs.executeScript(tab.id, | 98 chrome.tabs.executeScript(tab.id, |
99 {code: 'chrome.extension.sendRequest({' + | 99 {code: 'chrome.extension.sendRequest({' + |
100 ' inIncognitoContext: chrome.extension.inIncognitoContext' + | 100 ' inIncognitoContext: chrome.extension.inIncognitoContext' + |
101 '});'}, | 101 '});'}, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 // Tests that we can set cookies in both processes. | 148 // Tests that we can set cookies in both processes. |
149 function setDocumentCookie() { | 149 function setDocumentCookie() { |
150 document.cookie = "k=v"; | 150 document.cookie = "k=v"; |
151 chrome.test.assertTrue(document.cookie.indexOf("k=v") != -1); | 151 chrome.test.assertTrue(document.cookie.indexOf("k=v") != -1); |
152 chrome.test.succeed(); | 152 chrome.test.succeed(); |
153 } | 153 } |
154 ]); | 154 ]); |
155 | 155 |
156 }); | 156 }); |
OLD | NEW |