Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 function assertNoSensitiveFields(tab) { | |
| 6 ['url', 'title', 'faviconUrl'].forEach(function(field) { | |
| 7 chrome.test.assertEq(undefined, tab[field], | |
| 8 'Sensitive property ' + field + ' is visible') | |
| 9 }); | |
| 10 } | |
| 11 | |
| 12 chrome.test.runTests([ | |
| 13 function testOnUpdated() { | |
| 14 var neededEvents = 3; // two onUpdateListener calls, one create callback | |
| 15 var eventHandled = function() { | |
| 16 neededEvents--; | |
| 17 if (neededEvents == 0) { | |
| 18 chrome.tabs.onUpdated.removeListener(onUpdateListener); | |
| 19 chrome.test.succeed(); | |
| 20 } | |
| 21 }; | |
| 22 | |
| 23 var onUpdateListener = function(tabId, info, tab) { | |
| 24 assertNoSensitiveFields(tab); | |
| 25 eventHandled(); | |
| 26 } | |
| 27 | |
| 28 chrome.tabs.onUpdated.addListener(onUpdateListener); | |
| 29 chrome.tabs.create({url: 'chrome://newtab/'}, function(tab) { | |
| 30 assertNoSensitiveFields(tab); | |
| 31 chrome.tabs.update(tab.id, {url: 'about:blank'}, function(tab) { | |
| 32 assertNoSensitiveFields(tab); | |
| 33 eventHandled(); | |
|
not at google - send to devlin
2013/01/11 21:44:41
nitty comment: I was briefly confused here, this i
not at google - send to devlin
2013/01/11 21:45:22
s/event/function/
mvrable
2013/01/11 21:57:06
Done.
| |
| 34 }); | |
| 35 }); | |
| 36 }, | |
| 37 | |
| 38 function testQuery() { | |
| 39 chrome.tabs.create({url: 'chrome://newtab/'}); | |
| 40 chrome.tabs.query({active: true}, chrome.test.callbackPass(function(tabs) { | |
| 41 chrome.test.assertEq(1, tabs.length); | |
| 42 assertNoSensitiveFields(tabs[0]); | |
| 43 })); | |
| 44 }, | |
| 45 | |
| 46 ]); | |
| OLD | NEW |