| 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 expectedEventData = [{status: 'loading'}, {status: 'complete'}, | |
| 15 {status: 'loading'}, {status: 'complete'}]; | |
| 16 var capturedEventData = []; | |
| 17 | |
| 18 var onUpdateListener = function(tabId, info, tab) { | |
| 19 capturedEventData.push(info); | |
| 20 if (capturedEventData.length < expectedEventData.length) | |
| 21 return; | |
| 22 chrome.tabs.onUpdated.removeListener(onUpdateListener); | |
| 23 chrome.test.assertEq(expectedEventData, capturedEventData); | |
| 24 chrome.test.succeed(); | |
| 25 } | |
| 26 | |
| 27 chrome.tabs.onUpdated.addListener(onUpdateListener); | |
| 28 chrome.tabs.create({url: 'chrome://newtab/'}, function(tab) { | |
| 29 assertNoSensitiveFields(tab); | |
| 30 chrome.tabs.update(tab.id, {url: 'about:blank'}, function(tab) { | |
| 31 assertNoSensitiveFields(tab); | |
| 32 chrome.tabs.create({url: 'chrome://newtab/'}); | |
| 33 }); | |
| 34 }); | |
| 35 }, | |
| 36 | |
| 37 function testQuery() { | |
| 38 chrome.tabs.create({url: 'chrome://newtab/'}); | |
| 39 chrome.tabs.query({active: true}, chrome.test.callbackPass(function(tabs) { | |
| 40 chrome.test.assertEq(1, tabs.length); | |
| 41 assertNoSensitiveFields(tabs[0]); | |
| 42 })); | |
| 43 }, | |
| 44 | |
| 45 ]); | |
| OLD | NEW |