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

Side by Side Diff: chrome/test/data/extensions/api_test/settings/simple_test/background.html

Issue 8491033: Extension Settings API: throttle the API in the same way that the Bookmarks API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 1 month 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/browser/extensions/settings/settings_api.cc ('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 <script> 1 <script>
2 // Calls chrome.test.succeed after the settings have been cleared for the next 2 // Calls chrome.test.succeed after the settings have been cleared for the next
3 // test. 3 // test.
4 function succeed() { 4 function succeed() {
5 chrome.experimental.settings.clear(chrome.test.succeed); 5 chrome.experimental.settings.clear(chrome.test.succeed);
6 } 6 }
7 7
8 chrome.test.runTests([ 8 chrome.test.runTests([
9 function getWhenEmpty() { 9 function getWhenEmpty() {
10 function stage0() { 10 function stage0() {
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 }, stage8); 278 }, stage8);
279 } 279 }
280 function stage8(settings) { 280 function stage8(settings) {
281 chrome.test.assertEq({ 281 chrome.test.assertEq({
282 'foo': 'defaultBar', 282 'foo': 'defaultBar',
283 'baz': {} 283 'baz': {}
284 }, settings); 284 }, settings);
285 succeed(); 285 succeed();
286 } 286 }
287 stage0(); 287 stage0();
288 },
289
290 function throttling() {
291 // Should get throttled after 1000 calls.
292 var maxRequests = 1001;
293 function next() {
294 chrome.experimental.settings.clear((--maxRequests > 0) ? next : done);
295 }
296 function done() {
297 chrome.test.assertEq(
298 "This request exceeds available quota.",
299 chrome.extension.lastError.message);
300 succeed();
301 }
302 chrome.experimental.settings.clear(next);
288 } 303 }
289 ]); 304 ]);
290 </script> 305 </script>
OLDNEW
« no previous file with comments | « chrome/browser/extensions/settings/settings_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698