Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5258)

Unified Diff: chrome/test/data/extensions/api_test/activity_log_private/test/test.js

Issue 19014003: Modifications to activity logging end to end tests. Reduces the number of window.open calls to make… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix things mentioned in review comments Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 57f97810d3e4b70f26898b57830ffb1820f58446..af5e246af7ced9f44d4dee2f3c9a697868dcda23 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,50 +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 triggerInjectCSIncognito() {
- chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'inject_cs_incognito', function response() { });
- },
- is_incognito: true,
- expected_activity: [
- 'windows.create',
- '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() {});
@@ -84,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() {
@@ -101,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() { });
@@ -141,129 +81,16 @@ testCases.push({
expected_activity: ['runtime.connect']
});
testCases.push({
- func: function triggerLocationAccess() {
- chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'location_access', function response() { });
- },
- expected_activity: [
- 'tabs.onUpdated',
- 'tabs.onUpdated',
- 'tabs.executeScript',
- 'tabs.remove'
- ]
-});
-testCases.push({
- func: function triggerDomMutation1() {
- chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'dom_mutation1', function response() { });
- },
- expected_activity: [
- 'tabs.onUpdated',
- 'tabs.onUpdated',
- 'tabs.executeScript',
- 'tabs.remove'
- ]
-});
-testCases.push({
- func: function triggerDomMutation2() {
- chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'dom_mutation2', function response() { });
- },
- expected_activity: [
- 'tabs.onUpdated',
- 'tabs.onUpdated',
- 'tabs.executeScript',
- 'tabs.remove'
- ]
-});
-testCases.push({
- func: function triggerNavigatorAccess() {
- chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'navigator_access', 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.remove'
- ]
-});
-testCases.push({
- func: function triggerWebStorageAccess2() {
- chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'web_storage_access2', function response() { });
- },
- expected_activity: [
- 'tabs.onUpdated',
- 'tabs.onUpdated',
- 'tabs.executeScript',
- 'tabs.remove'
- ]
-});
-testCases.push({
- func: function triggerNotificationAccess() {
- chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'notification_access', function response() { });
- },
- expected_activity: [
- 'tabs.onUpdated',
- 'tabs.onUpdated',
- 'tabs.executeScript',
- 'tabs.remove'
- ]
-});
-testCases.push({
- func: function triggerApplicationCacheAccess() {
- chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'application_cache_access',
- function response() { });
- },
- expected_activity: [
- 'tabs.onUpdated',
- 'tabs.onUpdated',
- 'tabs.executeScript',
- 'tabs.remove'
- ]
-});
-testCases.push({
- func: function triggerWebDatabaseAccess() {
- chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'web_database_access',
- function response() { });
- },
- expected_activity: [
- 'tabs.onUpdated',
- 'tabs.onUpdated',
- 'tabs.executeScript',
- 'tabs.remove'
- ]
-});
-testCases.push({
- func: function triggerCanvasAccess() {
+ func: function triggerBackgroundXHR() {
chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'canvas_access', function response() { });
+ 'background_xhr', function response() { });
},
expected_activity: [
- 'tabs.onUpdated',
- 'tabs.onUpdated',
- 'tabs.executeScript',
- 'tabs.remove'
+ 'XMLHttpRequest.open',
+ 'XMLHttpRequest.setRequestHeader'
]
});
testCases.push({
- name: 'tab_ids',
func: function triggerTabIds() {
chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
'tab_ids', function response() { });
@@ -274,11 +101,11 @@ testCases.push({
'tabs.executeScript',
'tabs.onUpdated',
'tabs.onUpdated',
+ 'tabs.move',
'tabs.remove'
]
});
testCases.push({
- name: 'tab_ids_incognito',
func: function triggerTabIdsIncognito() {
chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
'tab_ids_incognito', function response() { });
@@ -292,10 +119,10 @@ testCases.push({
'windows.create',
'tabs.onUpdated',
'tabs.onUpdated',
+ 'tabs.move',
'tabs.remove'
]
});
-
testCases.push({
func: function triggerWebRequest() {
chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
@@ -312,7 +139,6 @@ testCases.push({
'tabs.remove'
]
});
-
testCases.push({
func: function triggerWebRequestIncognito() {
chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
@@ -333,28 +159,53 @@ testCases.push({
});
testCases.push({
- func: function triggerBackgroundXHR() {
+ func: function triggerApiCallsOnTabsUpdated() {
chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'cs_xhr', function response() { });
+ 'api_tab_updated', function response() { });
},
expected_activity: [
'tabs.onUpdated',
'tabs.onUpdated',
+ 'tabs.connect',
+ 'tabs.sendMessage',
+ 'tabs.executeScript',
'tabs.executeScript',
'tabs.remove'
]
});
-
testCases.push({
- func: function triggerBackgroundXHR() {
+ func: function triggerApiCallsOnTabsUpdatedIncognito() {
chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
- 'background_xhr', function response() { });
+ 'api_tab_updated_incognito',
+ function response() { });
},
+ is_incognito: true,
expected_activity: [
- 'XMLHttpRequest.open',
- 'XMLHttpRequest.setRequestHeader'
+ 'windows.create',
+ 'tabs.onUpdated',
+ 'tabs.onUpdated',
+ 'tabs.connect',
+ 'tabs.sendMessage',
+ 'tabs.executeScript',
+ 'tabs.executeScript',
+ 'tabs.remove'
]
});
+testCases.push({
+ func: function triggerDOMChangesOnTabsUpdated() {
+ chrome.runtime.sendMessage('pknkgggnfecklokoggaggchhaebkajji',
+ 'dom_tab_updated', function response() { });
+ },
+ // TODO(karenlees): some dom activity should also be logged here.
+ // Add the expected dom calls when chrome issue 259079 is fixed.
+ expected_activity: [
+ 'tabs.onUpdated',
+ 'tabs.onUpdated',
+ 'tabs.executeScript',
+ 'tabs.remove'
+ ]
+});
+
// Listener to check the expected logging is done in the test cases.
var testCaseIndx = 0;
@@ -364,11 +215,14 @@ chrome.activityLogPrivate.onExtensionActivity.addListener(
var activityId = activity['extensionId'];
chrome.test.assertEq('pknkgggnfecklokoggaggchhaebkajji', activityId);
- // Get the api call info from either the chrome activity or dom activity.
+ // Get the api call info from the chrome activity, dom activity or blocked
+ // chrome activity detail depending on what type of activity this is.
var activityType = activity['activityType'];
var activityDetailName = 'chromeActivityDetail';
if (activity['activityType'] == 'dom') {
activityDetailName = 'domActivityDetail';
+ } else if (activity['activityType'] == 'blocked_chrome') {
+ activityDetailName = 'blockedChromeActivityDetail';
}
// Check the api call is the one we expected next.

Powered by Google App Engine
This is Rietveld 408576698