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

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

Issue 9274004: Take the Extension Storage API out of experimental. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 function test(stage0) { 5 function test(stage0) {
6 var apis = [ 6 var apis = [
7 chrome.experimental.storage.sync, 7 chrome.storage.sync,
8 chrome.experimental.storage.local 8 chrome.storage.local
9 ]; 9 ];
10 apis.forEach(function(api) { 10 apis.forEach(function(api) {
11 api.succeed = chrome.test.callbackPass(api.clear.bind(api)); 11 api.succeed = chrome.test.callbackPass(api.clear.bind(api));
12 stage0.call(api); 12 stage0.call(api);
13 }); 13 });
14 } 14 }
15 15
16 chrome.test.runTests([ 16 chrome.test.runTests([
17 function getWhenEmpty() { 17 function getWhenEmpty() {
18 function stage0() { 18 function stage0() {
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 'baz': {} 287 'baz': {}
288 }, settings); 288 }, settings);
289 this.succeed(); 289 this.succeed();
290 } 290 }
291 test(stage0); 291 test(stage0);
292 }, 292 },
293 293
294 function throttling() { 294 function throttling() {
295 // We can only really test one of the namespaces since they will all get 295 // We can only really test one of the namespaces since they will all get
296 // throttled together. 296 // throttled together.
297 var api = chrome.experimental.storage.sync; 297 var api = chrome.storage.sync;
298 298
299 // Should get throttled after 1000 calls. 299 // Should get throttled after 1000 calls.
300 var maxRequests = 1001; 300 var maxRequests = 1001;
301 301
302 function next() { 302 function next() {
303 api.clear((--maxRequests > 0) ? next : done); 303 api.clear((--maxRequests > 0) ? next : done);
304 } 304 }
305 function done() { 305 function done() {
306 chrome.test.assertEq( 306 chrome.test.assertEq(
307 "This request exceeds available quota.", 307 "This request exceeds available quota.",
308 chrome.extension.lastError.message); 308 chrome.extension.lastError.message);
309 chrome.test.succeed(); 309 chrome.test.succeed();
310 } 310 }
311 api.clear(next); 311 api.clear(next);
312 } 312 }
313 ]); 313 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698