| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Bookmark Manager API test for Chrome. | 5 // Bookmark Manager API test for Chrome. |
| 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.BookmarkManagerEditDisabled | 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.BookmarkManagerEditDisabled |
| 7 | 7 |
| 8 const pass = chrome.test.callbackPass; | 8 const pass = chrome.test.callbackPass; |
| 9 const fail = chrome.test.callbackFail; | 9 const fail = chrome.test.callbackFail; |
| 10 const assertEq = chrome.test.assertEq; | 10 const assertEq = chrome.test.assertEq; |
| 11 const assertFalse = chrome.test.assertFalse; | 11 const assertFalse = chrome.test.assertFalse; |
| 12 const assertTrue = chrome.test.assertTrue; | 12 const assertTrue = chrome.test.assertTrue; |
| 13 const bookmarks = chrome.bookmarks; | 13 const bookmarks = chrome.bookmarks; |
| 14 const bookmarkManager = chrome.experimental.bookmarkManager; | 14 const bookmarkManager = chrome.experimental.bookmarkManager; |
| 15 | 15 |
| 16 var ERROR = "Bookmark editing is disabled."; | 16 var ERROR = "Bookmark editing is disabled."; |
| 17 | 17 |
| 18 // Bookmark model within this test: | 18 // Bookmark model within this test: |
| 19 // <root>/ | 19 // <root>/ |
| 20 // Bookmarks Bar/ | 20 // Bookmarks Bar/ |
| 21 // Folder/ | 21 // Folder/ |
| 22 // "BBB" | 22 // "BBB" |
| 23 // "AAA" | 23 // "AAA" |
| 24 // Other Bookmarks/ | 24 // Other Bookmarks/ |
| 25 // Mobile Bookmarks/ |
| 25 | 26 |
| 26 var tests = [ | 27 var tests = [ |
| 27 function verifyModel() { | 28 function verifyModel() { |
| 28 bookmarks.getTree(pass(function(result) { | 29 bookmarks.getTree(pass(function(result) { |
| 29 assertEq(1, result.length); | 30 assertEq(1, result.length); |
| 30 var root = result[0]; | 31 var root = result[0]; |
| 31 assertEq(2, root.children.length); | 32 assertEq(3, root.children.length); |
| 32 bar = root.children[0]; | 33 bar = root.children[0]; |
| 33 assertEq(2, bar.children.length); | 34 assertEq(2, bar.children.length); |
| 34 folder = bar.children[0]; | 35 folder = bar.children[0]; |
| 35 aaa = bar.children[1]; | 36 aaa = bar.children[1]; |
| 36 assertEq('Folder', folder.title); | 37 assertEq('Folder', folder.title); |
| 37 assertEq('AAA', aaa.title); | 38 assertEq('AAA', aaa.title); |
| 38 bbb = folder.children[0]; | 39 bbb = folder.children[0]; |
| 39 assertEq('BBB', bbb.title); | 40 assertEq('BBB', bbb.title); |
| 40 })); | 41 })); |
| 41 }, | 42 }, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 }, | 78 }, |
| 78 | 79 |
| 79 function editDisabled() { | 80 function editDisabled() { |
| 80 bookmarkManager.canEdit(pass(function(result) { | 81 bookmarkManager.canEdit(pass(function(result) { |
| 81 assertFalse(result, 'Should not be able to edit bookmarks'); | 82 assertFalse(result, 'Should not be able to edit bookmarks'); |
| 82 })); | 83 })); |
| 83 } | 84 } |
| 84 ]; | 85 ]; |
| 85 | 86 |
| 86 chrome.test.runTests(tests); | 87 chrome.test.runTests(tests); |
| OLD | NEW |