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

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

Issue 308273002: Made the bookmarks extension APIs aware of managed bookmarks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/bookmarks/test.js
diff --git a/chrome/test/data/extensions/api_test/bookmarks/test.js b/chrome/test/data/extensions/api_test/bookmarks/test.js
index b48a289be1eeefc4931ece43fc65548ed57f3cf1..7a95a5b46602cd3f730d737dd77ca8bf8546160e 100644
--- a/chrome/test/data/extensions/api_test/bookmarks/test.js
+++ b/chrome/test/data/extensions/api_test/bookmarks/test.js
@@ -12,7 +12,13 @@
var expected = [
{"children": [
{children:[], id:"1", parentId:"0", index:0, title:"Bookmarks bar"},
- {children:[], id:"2", parentId:"0", index:1, title:"Other bookmarks"}
+ {children:[], id:"2", parentId:"0", index:1, title:"Other bookmarks"},
+ {id:"4", parentId:"0", index:3, title:"Managed bookmarks", children:[
+ {id:"5", parentId:"4", index:0, title:"Managed Bookmark",
+ url: "http://www.chromium.org/"},
+ {id:"6", parentId:"4", index:1, title:"Managed Folder", children:[]}
+ ]
+ }
],
id:"0", title:""
}
@@ -130,6 +136,10 @@ chrome.test.runTests([
chrome.bookmarks.get("1", pass(function(results) {
chrome.test.assertTrue(compareNode(results[0], expected[0].children[0]));
}));
+ chrome.bookmarks.get("5", pass(function(results) {
+ chrome.test.assertTrue(compareNode(
+ results[0], expected[0].children[2].children[0]));
+ }));
chrome.bookmarks.get("42", fail("Can't find bookmark for id."));
},
@@ -193,6 +203,12 @@ chrome.test.runTests([
chrome.bookmarks.create(node, fail(error));
},
+ function createInManaged() {
+ const error = "Can't modify managed bookmarks.";
+ var node = {parentId:"4", title:"g404", url:"http://www.google.com/404"};
+ chrome.bookmarks.create(node, fail(error));
+ },
+
function createFolder() {
var node = {parentId:"1", title:"foo bar"}; // folder
chrome.test.listenOnce(chrome.bookmarks.onCreated, function(id, created) {
@@ -286,6 +302,23 @@ chrome.test.runTests([
}));
},
+ function moveToManaged() {
+ var managed_node = expected[0].children[2];
+ chrome.test.assertEq("4", managed_node.id);
+ const error = "Can't modify managed bookmarks.";
+ chrome.bookmarks.move(node1.id, {parentId:managed_node.id}, fail(error));
+ verifyTreeIsExpected(pass());
+ },
+
+ function moveFromManaged() {
+ var managed_node = expected[0].children[2];
+ var moving_node = managed_node.children[0];
+ var other = expected[0].children[1];
+ const error = "Can't modify managed bookmarks.";
+ chrome.bookmarks.move(moving_node.id, {parentId:other.id}, fail(error));
+ verifyTreeIsExpected(pass());
+ },
+
function search() {
chrome.bookmarks.search("baz bar", pass(function(results) {
// matches node1 & node3
@@ -312,6 +345,11 @@ chrome.test.runTests([
// Does not match any node since permanent nodes are stripped from search
chrome.test.assertEq(0, results.length);
}));
+ chrome.bookmarks.search("Managed", pass(function(results) {
+ // Matches the Managed Bookmark and the Managed Folder but not the
+ // managed_node.
+ chrome.test.assertEq(2, results.length);
+ }));
},
function update() {
@@ -353,6 +391,13 @@ chrome.test.runTests([
}));
},
+ function updateManaged() {
+ var managed_node = expected[0].children[2];
+ var updating_node = managed_node.children[0];
+ const error = "Can't modify managed bookmarks.";
+ chrome.bookmarks.update(updating_node.id, {"title": "New"}, fail(error));
+ },
+
function remove() {
var parentId = node1.parentId;
chrome.test.listenOnce(chrome.bookmarks.onRemoved,
@@ -372,6 +417,13 @@ chrome.test.runTests([
}));
},
+ function removeManaged() {
+ var managed_node = expected[0].children[2];
+ var removing_node = managed_node.children[0];
+ const error = "Can't modify managed bookmarks.";
+ chrome.bookmarks.remove(removing_node.id, fail(error));
+ },
+
function searchRemoved() {
// Search for deleted node
chrome.bookmarks.search("baz bar", pass(function(results) {
@@ -493,7 +545,8 @@ chrome.test.runTests([
chrome.test.assertTrue(failed, "Calling with 0 should fail");
chrome.bookmarks.getRecent(10000, pass(function(results) {
- chrome.test.assertEq(3, results.length,
+ // Should include the "Managed Bookmark".
+ chrome.test.assertEq(4, results.length,
"Should have gotten all recent bookmarks");
}));

Powered by Google App Engine
This is Rietveld 408576698