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/ | |
26 | 25 |
27 var tests = [ | 26 var tests = [ |
28 function verifyModel() { | 27 function verifyModel() { |
29 bookmarks.getTree(pass(function(result) { | 28 bookmarks.getTree(pass(function(result) { |
30 assertEq(1, result.length); | 29 assertEq(1, result.length); |
31 var root = result[0]; | 30 var root = result[0]; |
32 assertEq(3, root.children.length); | 31 assertEq(2, root.children.length); |
33 bar = root.children[0]; | 32 bar = root.children[0]; |
34 assertEq(2, bar.children.length); | 33 assertEq(2, bar.children.length); |
35 folder = bar.children[0]; | 34 folder = bar.children[0]; |
36 aaa = bar.children[1]; | 35 aaa = bar.children[1]; |
37 assertEq('Folder', folder.title); | 36 assertEq('Folder', folder.title); |
38 assertEq('AAA', aaa.title); | 37 assertEq('AAA', aaa.title); |
39 bbb = folder.children[0]; | 38 bbb = folder.children[0]; |
40 assertEq('BBB', bbb.title); | 39 assertEq('BBB', bbb.title); |
41 })); | 40 })); |
42 }, | 41 }, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 }, | 77 }, |
79 | 78 |
80 function editDisabled() { | 79 function editDisabled() { |
81 bookmarkManager.canEdit(pass(function(result) { | 80 bookmarkManager.canEdit(pass(function(result) { |
82 assertFalse(result, 'Should not be able to edit bookmarks'); | 81 assertFalse(result, 'Should not be able to edit bookmarks'); |
83 })); | 82 })); |
84 } | 83 } |
85 ]; | 84 ]; |
86 | 85 |
87 chrome.test.runTests(tests); | 86 chrome.test.runTests(tests); |
OLD | NEW |