| Index: chrome/test/data/extensions/api_test/activity_log_private/test/test.js
|
| diff --git a/chrome/test/data/extensions/api_test/activity_log_private/test/test.js b/chrome/test/data/extensions/api_test/activity_log_private/test/test.js
|
| index e354de18eecf242708bb410985e7d07d1cef24fc..604015f84186e3e7f49f42f8854de684692c0fdc 100644
|
| --- a/chrome/test/data/extensions/api_test/activity_log_private/test/test.js
|
| +++ b/chrome/test/data/extensions/api_test/activity_log_private/test/test.js
|
| @@ -22,36 +22,6 @@ testCases.push({
|
| ]
|
| });
|
| testCases.push({
|
| - func: function triggerBlockedCall() {
|
| - chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'blocked_call', function response() { });
|
| - },
|
| - expected_activity: []
|
| -});
|
| -testCases.push({
|
| - func: function triggerInjectCS() {
|
| - chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'inject_cs', function response() { });
|
| - },
|
| - expected_activity: [
|
| - 'tabs.onUpdated',
|
| - 'tabs.onUpdated',
|
| - 'tabs.executeScript',
|
| - 'tabs.remove'
|
| - ]
|
| -});
|
| -testCases.push({
|
| - func: function triggerInsertBlob() {
|
| - chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'inject_blob', function response() { });
|
| - },
|
| - expected_activity: [
|
| - 'tabs.onUpdated',
|
| - 'tabs.onUpdated',
|
| - 'tabs.executeScript',
|
| - 'tabs.remove']
|
| -});
|
| -testCases.push({
|
| func: function triggerDouble() {
|
| chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| 'double', function response() {});
|
| @@ -70,14 +40,11 @@ testCases.push({
|
| ]
|
| });
|
| testCases.push({
|
| - func: function triggerObjectProperties() {
|
| + func: function triggerBlockedCall() {
|
| chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'object_properties', function response() { });
|
| - },
|
| - expected_activity: [
|
| - 'tabs.onUpdated',
|
| - 'tabs.onUpdated',
|
| - 'tabs.remove']
|
| + 'blocked_call', function response() { });
|
| + },
|
| + expected_activity: []
|
| });
|
| testCases.push({
|
| func: function triggerObjectMethods() {
|
| @@ -87,19 +54,6 @@ testCases.push({
|
| expected_activity: ['storage.clear']
|
| });
|
| testCases.push({
|
| - func: function triggerMessageCS() {
|
| - chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'message_cs', function response() { });
|
| - },
|
| - expected_activity: [
|
| - 'tabs.onUpdated',
|
| - 'tabs.onUpdated',
|
| - 'tabs.connect',
|
| - 'tabs.sendMessage',
|
| - 'tabs.remove'
|
| - ]
|
| -});
|
| -testCases.push({
|
| func: function triggerMessageSelf() {
|
| chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| 'message_self', function response() { });
|
| @@ -127,183 +81,140 @@ testCases.push({
|
| expected_activity: ['runtime.connect']
|
| });
|
| testCases.push({
|
| - func: function triggerLocationAccess() {
|
| + func: function triggerBackgroundXHR() {
|
| chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'location_access', function response() { });
|
| + 'background_xhr', function response() { });
|
| },
|
| expected_activity: [
|
| - 'tabs.onUpdated',
|
| - 'tabs.onUpdated',
|
| - 'tabs.executeScript',
|
| - 'tabs.remove'
|
| + 'XMLHttpRequest.open',
|
| + 'XMLHttpRequest.setRequestHeader'
|
| ]
|
| });
|
| testCases.push({
|
| - func: function triggerDomMutation1() {
|
| + func: function triggerWebRequest() {
|
| chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'dom_mutation1', function response() { });
|
| + 'webrequest', function response() { });
|
| },
|
| expected_activity: [
|
| + 'webRequestInternal.addEventListener',
|
| + 'webRequestInternal.addEventListener',
|
| + 'webRequest.onBeforeSendHeaders/1',
|
| + 'webRequestInternal.eventHandled',
|
| + 'webRequest.onBeforeSendHeaders',
|
| 'tabs.onUpdated',
|
| 'tabs.onUpdated',
|
| - 'tabs.executeScript',
|
| 'tabs.remove'
|
| ]
|
| });
|
| -testCases.push({
|
| - func: function triggerDomMutation2() {
|
| +/*testCases.push({
|
| + func: function triggerWebRequestIncognito() {
|
| chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'dom_mutation2', function response() { });
|
| + 'webrequest_incognito', function response() { });
|
| },
|
| + is_incognito: true,
|
| expected_activity: [
|
| + 'webRequestInternal.addEventListener',
|
| + 'webRequestInternal.addEventListener',
|
| + 'windows.create',
|
| + 'webRequest.onBeforeSendHeaders/3',
|
| + 'webRequestInternal.eventHandled',
|
| + 'webRequest.onBeforeSendHeaders',
|
| 'tabs.onUpdated',
|
| 'tabs.onUpdated',
|
| - 'tabs.executeScript',
|
| 'tabs.remove'
|
| ]
|
| -});
|
| +});*/
|
| testCases.push({
|
| - func: function triggerNavigatorAccess() {
|
| + func: function triggerTabIds() {
|
| chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'navigator_access', function response() { });
|
| + 'tab_ids', function response() { });
|
| },
|
| expected_activity: [
|
| 'tabs.onUpdated',
|
| 'tabs.onUpdated',
|
| 'tabs.executeScript',
|
| - 'tabs.remove'
|
| - ]
|
| -});
|
| -testCases.push({
|
| - func: function triggerWebStorageAccess1() {
|
| - chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'web_storage_access1', function response() { });
|
| - },
|
| - expected_activity: [
|
| 'tabs.onUpdated',
|
| 'tabs.onUpdated',
|
| - 'tabs.executeScript',
|
| + 'tabs.move',
|
| 'tabs.remove'
|
| ]
|
| });
|
| -testCases.push({
|
| - func: function triggerWebStorageAccess2() {
|
| +/*testCases.push({
|
| + func: function triggerTabIdsIncognito() {
|
| chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'web_storage_access2', function response() { });
|
| + 'tab_ids_incognito', function response() { });
|
| },
|
| + is_incognito: true,
|
| expected_activity: [
|
| + 'windows.create',
|
| 'tabs.onUpdated',
|
| 'tabs.onUpdated',
|
| 'tabs.executeScript',
|
| - 'tabs.remove'
|
| - ]
|
| -});
|
| -testCases.push({
|
| - func: function triggerNotificationAccess() {
|
| - chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'notification_access', function response() { });
|
| - },
|
| - expected_activity: [
|
| + 'windows.create',
|
| 'tabs.onUpdated',
|
| 'tabs.onUpdated',
|
| - 'tabs.executeScript',
|
| + 'tabs.move',
|
| 'tabs.remove'
|
| ]
|
| -});
|
| +});*/
|
| testCases.push({
|
| - func: function triggerApplicationCacheAccess() {
|
| + func: function triggerApiCallsOnTabsUpdated() {
|
| chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'application_cache_access',
|
| - function response() { });
|
| + 'api_tab_updated', function response() { });
|
| },
|
| expected_activity: [
|
| 'tabs.onUpdated',
|
| 'tabs.onUpdated',
|
| 'tabs.executeScript',
|
| + 'tabs.executeScript',
|
| + 'tabs.connect',
|
| + 'tabs.sendMessage',
|
| 'tabs.remove'
|
| ]
|
| });
|
| -testCases.push({
|
| - func: function triggerWebDatabaseAccess() {
|
| +/*testCases.push({
|
| + func: function triggerApiCallsOnTabsUpdatedIncognito() {
|
| chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'web_database_access',
|
| + 'api_tab_updated_incognito',
|
| function response() { });
|
| },
|
| expected_activity: [
|
| + 'windows.create',
|
| 'tabs.onUpdated',
|
| 'tabs.onUpdated',
|
| 'tabs.executeScript',
|
| - 'tabs.remove'
|
| - ]
|
| -});
|
| -testCases.push({
|
| - func: function triggerCanvasAccess() {
|
| - chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'canvas_access', function response() { });
|
| - },
|
| - expected_activity: [
|
| - 'tabs.onUpdated',
|
| - 'tabs.onUpdated',
|
| 'tabs.executeScript',
|
| + 'tabs.connect',
|
| + 'tabs.sendMessage',
|
| 'tabs.remove'
|
| ]
|
| -});
|
| +});*/
|
| testCases.push({
|
| - name: 'tab_ids',
|
| - func: function triggerTabIds() {
|
| + func: function triggerDOMChangesOnTabsUpdated() {
|
| chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'tab_ids', function response() { });
|
| + 'dom_tab_updated', function response() { });
|
| },
|
| + // TODO(karenlees): at the moment this just checks that all the scripts in the
|
| + // test were run. Really it should check that DOM changes are logged as well.
|
| + // Find out why no DOM changes are being logged...
|
| expected_activity: [
|
| 'tabs.onUpdated',
|
| 'tabs.onUpdated',
|
| 'tabs.executeScript',
|
| - 'tabs.onUpdated',
|
| - 'tabs.onUpdated',
|
| - 'tabs.remove'
|
| - ]
|
| -});
|
| -
|
| -testCases.push({
|
| - func: function triggerWebRequest() {
|
| - chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'webrequest', function response() { });
|
| - },
|
| - expected_activity: [
|
| - 'webRequestInternal.addEventListener',
|
| - 'webRequestInternal.addEventListener',
|
| - 'webRequest.onBeforeSendHeaders/1',
|
| - 'webRequestInternal.eventHandled',
|
| - 'webRequest.onBeforeSendHeaders',
|
| - 'tabs.onUpdated',
|
| - 'tabs.onUpdated',
|
| - 'tabs.remove'
|
| - ]
|
| -});
|
| -
|
| -testCases.push({
|
| - func: function triggerBackgroundXHR() {
|
| - chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'cs_xhr', function response() { });
|
| - },
|
| - expected_activity: [
|
| - 'tabs.onUpdated',
|
| - 'tabs.onUpdated',
|
| + 'tabs.executeScript',
|
| + 'tabs.executeScript',
|
| + 'tabs.executeScript',
|
| + 'tabs.executeScript',
|
| + 'tabs.executeScript',
|
| + 'tabs.executeScript',
|
| + 'tabs.executeScript',
|
| + 'tabs.executeScript',
|
| + 'tabs.executeScript',
|
| 'tabs.executeScript',
|
| 'tabs.remove'
|
| ]
|
| });
|
|
|
| -testCases.push({
|
| - func: function triggerBackgroundXHR() {
|
| - chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
|
| - 'background_xhr', function response() { });
|
| - },
|
| - expected_activity: [
|
| - 'XMLHttpRequest.open',
|
| - 'XMLHttpRequest.setRequestHeader'
|
| - ]
|
| -});
|
|
|
| // Listener to check the expected logging is done in the test cases.
|
| var testCaseIndx = 0;
|
| @@ -329,6 +240,19 @@ chrome.activityLogPrivate.onExtensionActivity.addListener(
|
| console.log('Logged:' + apiCall + ' Expected:' + expectedCall);
|
| chrome.test.assertEq(expectedCall, apiCall);
|
|
|
| + // Check that no real URLs are logged in incognito-mode tests.
|
| + if (activity['activityType'] == 'dom') {
|
| + var url = activity[activityDetailName]['url'];
|
| + if (url) {
|
| + if (testCases[testCaseIndx].is_incognito) {
|
| + chrome.test.assertEq('http://incognito/', url);
|
| + } else {
|
| + chrome.test.assertTrue(url != 'http://incognito/',
|
| + 'Non-incognito URL was anonymized');
|
| + }
|
| + }
|
| + }
|
| +
|
| // If all the expected calls have been logged for this test case then
|
| // mark as suceeded and move to the next. Otherwise look for the next
|
| // expected api call.
|
|
|