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

Side by Side Diff: chrome/test/data/extensions/activity_log/options.js

Issue 12517011: Added activity logging for ext APIs with custom bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/activity_log/options.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 /** 5 /**
6 * Every test needs: 6 * Every test needs:
7 * - a button in options.html 7 * - a button in options.html
8 * - a function that runs the test & calls setCompleted when done 8 * - a function that runs the test & calls setCompleted when done
9 * - a listener registered in setupEvents 9 * - a listener registered in setupEvents
10 **/ 10 **/
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Makes an API call. 47 // Makes an API call.
48 function makeApiCall() { 48 function makeApiCall() {
49 chrome.cookies.set({ 49 chrome.cookies.set({
50 'url': 'https://www.cnn.com', 50 'url': 'https://www.cnn.com',
51 'name': 'activity_log_test_cookie', 51 'name': 'activity_log_test_cookie',
52 'value': 'abcdefg' 52 'value': 'abcdefg'
53 }); 53 });
54 setCompleted('makeApiCall'); 54 setCompleted('makeApiCall');
55 } 55 }
56 56
57 // Makes an API call that has a custom binding.
58 function makeSpecialApiCalls() {
59 var url = chrome.extension.getURL("image/cat.jpg");
60 var noparam = chrome.extension.getViews();
61 setCompleted('makeSpecialApiCalls');
62 }
63
64 // Checks that we don't double-log calls that go through setHandleRequest
65 // *and* the ExtensionFunction machinery.
66 function checkNoDoubleLogging() {
67 chrome.omnibox.setDefaultSuggestion({description: 'hello world'});
68 setCompleted('checkNoDoubleLogging');
69 }
70
57 // Makes an API call that the extension doesn't have permission for. 71 // Makes an API call that the extension doesn't have permission for.
58 function makeBlockedApiCall() { 72 function makeBlockedApiCall() {
59 try { 73 try {
60 var all_extensions = chrome.management.getAll(); 74 var all_extensions = chrome.management.getAll();
61 } catch(err) { } 75 } catch(err) { }
62 setCompleted('makeBlockedApiCall'); 76 setCompleted('makeBlockedApiCall');
63 } 77 }
64 78
65 // Injects a content script. 79 // Injects a content script.
66 function injectContentScript() { 80 function injectContentScript() {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 171 }
158 } 172 }
159 ); 173 );
160 window.open('http://www.google.co.uk'); 174 window.open('http://www.google.co.uk');
161 } 175 }
162 176
163 // REGISTER YOUR TESTS HERE 177 // REGISTER YOUR TESTS HERE
164 // Attach the tests to buttons. 178 // Attach the tests to buttons.
165 function setupEvents() { 179 function setupEvents() {
166 $('api_call').addEventListener('click', makeApiCall); 180 $('api_call').addEventListener('click', makeApiCall);
181 $('special_call').addEventListener('click', makeSpecialApiCalls);
167 $('blocked_call').addEventListener('click', makeBlockedApiCall); 182 $('blocked_call').addEventListener('click', makeBlockedApiCall);
168 $('inject_cs').addEventListener('click', injectContentScript); 183 $('inject_cs').addEventListener('click', injectContentScript);
169 $('inject_blob').addEventListener('click', injectScriptBlob); 184 $('inject_blob').addEventListener('click', injectScriptBlob);
170 $('background_xhr').addEventListener('click', doBackgroundXHR); 185 $('background_xhr').addEventListener('click', doBackgroundXHR);
171 $('cs_xhr').addEventListener('click', doContentScriptXHR); 186 $('cs_xhr').addEventListener('click', doContentScriptXHR);
172 $('webrequest').addEventListener('click', doWebRequestModifications); 187 $('webrequest').addEventListener('click', doWebRequestModifications);
188 $('double').addEventListener('click', checkNoDoubleLogging);
173 189
174 completed = 0; 190 completed = 0;
175 total = document.getElementsByTagName('button').length; 191 total = document.getElementsByTagName('button').length;
176 } 192 }
177 193
178 document.addEventListener('DOMContentLoaded', setupEvents); 194 document.addEventListener('DOMContentLoaded', setupEvents);
179 195
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/activity_log/options.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698