OLD | NEW |
1 // bookmarks api test | 1 // bookmarks api test |
2 // browser_tests.exe --gtest_filter=ExtensionApiTest.Bookmarks | 2 // browser_tests.exe --gtest_filter=ExtensionApiTest.Bookmarks |
3 | 3 |
4 var expected = [ | 4 var expected = [ |
5 {"children": [ | 5 {"children": [ |
6 {children:[], id:"1", parentId:"0", index:0, title:"Bookmarks bar"}, | 6 {children:[], id:"1", parentId:"0", index:0, title:"Bookmarks bar"}, |
7 {children:[], id:"2", parentId:"0", index:1, title:"Other bookmarks"} | 7 {children:[], id:"2", parentId:"0", index:1, title:"Other bookmarks"} |
8 ], | 8 ], |
9 id:"0", title:"" | 9 id:"0", title:"" |
10 } | 10 } |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 }, | 261 }, |
262 | 262 |
263 function update() { | 263 function update() { |
264 var title = "hello world"; | 264 var title = "hello world"; |
265 chrome.test.listenOnce(chrome.bookmarks.onChanged, function(id, changes) { | 265 chrome.test.listenOnce(chrome.bookmarks.onChanged, function(id, changes) { |
266 chrome.test.assertEq(title, changes.title); | 266 chrome.test.assertEq(title, changes.title); |
267 }); | 267 }); |
268 chrome.bookmarks.update(node1.id, {"title": title}, pass(function(results) { | 268 chrome.bookmarks.update(node1.id, {"title": title}, pass(function(results) { |
269 chrome.test.assertEq(title, results.title); | 269 chrome.test.assertEq(title, results.title); |
270 })); | 270 })); |
| 271 |
| 272 var url = "http://example.com/hello" |
| 273 chrome.bookmarks.update(node1.id, {"url": url}, pass(function(results) { |
| 274 // Make sure that leaving out the title does not set the title to empty. |
| 275 chrome.test.assertEq(title, results.title); |
| 276 chrome.test.assertEq(url, results.url); |
| 277 })); |
271 }, | 278 }, |
272 | 279 |
273 function remove() { | 280 function remove() { |
274 var parentId = node1.parentId; | 281 var parentId = node1.parentId; |
275 chrome.test.listenOnce(chrome.bookmarks.onRemoved, | 282 chrome.test.listenOnce(chrome.bookmarks.onRemoved, |
276 function(id, removeInfo) { | 283 function(id, removeInfo) { |
277 chrome.test.assertEq(id, node1.id); | 284 chrome.test.assertEq(id, node1.id); |
278 chrome.test.assertEq(removeInfo.parentId, parentId); | 285 chrome.test.assertEq(removeInfo.parentId, parentId); |
279 chrome.test.assertEq(removeInfo.index, node1.index); | 286 chrome.test.assertEq(removeInfo.index, node1.index); |
280 }); | 287 }); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 405 |
399 chrome.bookmarks.getRecent(2, pass(function(results) { | 406 chrome.bookmarks.getRecent(2, pass(function(results) { |
400 chrome.test.assertEq(2, results.length, | 407 chrome.test.assertEq(2, results.length, |
401 "Should only get the last 2 bookmarks"); | 408 "Should only get the last 2 bookmarks"); |
402 | 409 |
403 chrome.test.assertTrue(compareNode(node3, results[0])); | 410 chrome.test.assertTrue(compareNode(node3, results[0])); |
404 chrome.test.assertTrue(compareNode(node2, results[1])); | 411 chrome.test.assertTrue(compareNode(node2, results[1])); |
405 })); | 412 })); |
406 } | 413 } |
407 ]); | 414 ]); |
OLD | NEW |