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

Side by Side Diff: chrome/test/data/extensions/api_test/bookmarks/test.js

Issue 10871034: Make all quota-exceeding messages in the storage API explain what the failure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update... the other error message Created 8 years, 3 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) 2012 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 // bookmarks api test 5 // bookmarks api test
6 // browser_tests.exe --gtest_filter=ExtensionApiTest.Bookmarks 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.Bookmarks
7 7
8 // This is global state that is maintained across tests as a reference 8 // This is global state that is maintained across tests as a reference
9 // to compare against what's fetched from the browser (using compareTrees). 9 // to compare against what's fetched from the browser (using compareTrees).
10 // TODO(erikkay) It would be better if each test was self-contained and 10 // TODO(erikkay) It would be better if each test was self-contained and
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 })); 385 }));
386 }, 386 },
387 387
388 function quotaLimitedCreate() { 388 function quotaLimitedCreate() {
389 var node = {parentId:"1", title:"quotacreate", url:"http://www.quota.com/"}; 389 var node = {parentId:"1", title:"quotacreate", url:"http://www.quota.com/"};
390 for (i = 0; i < 100; i++) { 390 for (i = 0; i < 100; i++) {
391 chrome.bookmarks.create(node, pass(function(results) { 391 chrome.bookmarks.create(node, pass(function(results) {
392 expected[0].children[0].children.push(results); 392 expected[0].children[0].children.push(results);
393 })); 393 }));
394 } 394 }
395 chrome.bookmarks.create(node, 395 chrome.bookmarks.create(
396 fail("This request exceeds available quota.")); 396 node,
397 fail("This request exceeds the MAX_WRITE_OPERATIONS_PER_HOUR quota."));
397 398
398 chrome.test.resetQuota(); 399 chrome.test.resetQuota();
399 400
400 // Also, test that > 100 creations of different items is fine. 401 // Also, test that > 100 creations of different items is fine.
401 for (i = 0; i < 101; i++) { 402 for (i = 0; i < 101; i++) {
402 var changer = {parentId:"1", title:"" + i, url:"http://www.quota.com/"}; 403 var changer = {parentId:"1", title:"" + i, url:"http://www.quota.com/"};
403 chrome.bookmarks.create(changer, pass(function(results) { 404 chrome.bookmarks.create(changer, pass(function(results) {
404 expected[0].children[0].children.push(results); 405 expected[0].children[0].children.push(results);
405 })); 406 }));
406 } 407 }
(...skipping 10 matching lines...) Expand all
417 function quotaLimitedUpdate() { 418 function quotaLimitedUpdate() {
418 var title = "hello, world!"; 419 var title = "hello, world!";
419 for (i = 0; i < 100; i++) { 420 for (i = 0; i < 100; i++) {
420 chrome.bookmarks.update(quota_node1.id, {"title": title}, 421 chrome.bookmarks.update(quota_node1.id, {"title": title},
421 pass(function(results) { 422 pass(function(results) {
422 chrome.test.assertEq(title, results.title); 423 chrome.test.assertEq(title, results.title);
423 } 424 }
424 )); 425 ));
425 } 426 }
426 chrome.bookmarks.update(quota_node1.id, {"title": title}, 427 chrome.bookmarks.update(quota_node1.id, {"title": title},
427 fail("This request exceeds available quota.")); 428 fail("This request exceeds the MAX_WRITE_OPERATIONS_PER_HOUR quota."));
428 429
429 chrome.test.resetQuota(); 430 chrome.test.resetQuota();
430 }, 431 },
431 432
432 function getRecentSetup() { 433 function getRecentSetup() {
433 // Clean up tree 434 // Clean up tree
434 ["1", "2"].forEach(function(id) { 435 ["1", "2"].forEach(function(id) {
435 chrome.bookmarks.getChildren(id, pass(function(children) { 436 chrome.bookmarks.getChildren(id, pass(function(children) {
436 children.forEach(function(child, i) { 437 children.forEach(function(child, i) {
437 chrome.bookmarks.removeTree(child.id, pass(function() {})); 438 chrome.bookmarks.removeTree(child.id, pass(function() {}));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 "Should only get the last 2 bookmarks"); 483 "Should only get the last 2 bookmarks");
483 484
484 chrome.test.assertTrue(compareNode(node3, results[0])); 485 chrome.test.assertTrue(compareNode(node3, results[0]));
485 chrome.test.assertTrue(compareNode(node2, results[1])); 486 chrome.test.assertTrue(compareNode(node2, results[1]));
486 })); 487 }));
487 } 488 }
488 ]); 489 ]);
489 } 490 }
490 491
491 run(); 492 run();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698