| OLD | NEW |
| 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 // Bookmark Manager API test for Chrome. | 5 // Bookmark Manager API test for Chrome. |
| 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.BookmarkManager | 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.BookmarkManager |
| 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; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // Paste it. | 203 // Paste it. |
| 204 doPaste('1'); | 204 doPaste('1'); |
| 205 | 205 |
| 206 // Ensure it got added at the end. | 206 // Ensure it got added at the end. |
| 207 bookmarks.getChildren('1', pass(function(result) { | 207 bookmarks.getChildren('1', pass(function(result) { |
| 208 count++; | 208 count++; |
| 209 assertEq(count, result.length); | 209 assertEq(count, result.length); |
| 210 | 210 |
| 211 fooNode2 = result[result.length - 1]; | 211 fooNode2 = result[result.length - 1]; |
| 212 | 212 |
| 213 assertEq(fooNode.title, fooNode2.title); | 213 assertEq(fooNode.title + " (1)", fooNode2.title); |
| 214 assertEq(fooNode.url, fooNode2.url); | 214 assertEq(fooNode.url, fooNode2.url); |
| 215 assertEq(fooNode.parentId, fooNode2.parentId); | 215 assertEq(fooNode.parentId, fooNode2.parentId); |
| 216 })); | 216 })); |
| 217 }, | 217 }, |
| 218 | 218 |
| 219 function clipboard3() { | 219 function clipboard3() { |
| 220 // Cut fooNode bookmarks. | 220 // Cut fooNode bookmarks. |
| 221 doCut([fooNode.id, fooNode2.id]); | 221 doCut([fooNode.id, fooNode2.id]); |
| 222 | 222 |
| 223 // Ensure count decreased by 2. | 223 // Ensure count decreased by 2. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 246 if (result[barIndex].id == barNode.id) | 246 if (result[barIndex].id == barNode.id) |
| 247 break; | 247 break; |
| 248 } | 248 } |
| 249 assertTrue(barIndex + 2 < result.length); | 249 assertTrue(barIndex + 2 < result.length); |
| 250 | 250 |
| 251 var last = result[barIndex + 1]; | 251 var last = result[barIndex + 1]; |
| 252 var last2 = result[barIndex + 2]; | 252 var last2 = result[barIndex + 2]; |
| 253 assertEq(fooNode.title, last.title); | 253 assertEq(fooNode.title, last.title); |
| 254 assertEq(fooNode.url, last.url); | 254 assertEq(fooNode.url, last.url); |
| 255 assertEq(fooNode.parentId, last.parentId); | 255 assertEq(fooNode.parentId, last.parentId); |
| 256 assertEq(last.title, last2.title); | 256 assertEq(last.title + " (1)", last2.title); |
| 257 assertEq(last.url, last2.url); | 257 assertEq(last.url, last2.url); |
| 258 assertEq(last.parentId, last2.parentId); | 258 assertEq(last.parentId, last2.parentId); |
| 259 | 259 |
| 260 // Remember last2 id, so we can use it in next test. | 260 // Remember last2 id, so we can use it in next test. |
| 261 fooNode2.id = last2.id; | 261 fooNode2.id = last2.id; |
| 262 })); | 262 })); |
| 263 }, | 263 }, |
| 264 | 264 |
| 265 // Ensure we can copy empty folders | 265 // Ensure we can copy empty folders |
| 266 function clipboard5() { | 266 function clipboard5() { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 })); | 397 })); |
| 398 bookmarkManager.createWithMetaInfo(node, metaInfo, pass( | 398 bookmarkManager.createWithMetaInfo(node, metaInfo, pass( |
| 399 function(createdNode) { | 399 function(createdNode) { |
| 400 assertEq(node.title, createdNode.title); | 400 assertEq(node.title, createdNode.title); |
| 401 assertEq(node.url, createdNode.url); | 401 assertEq(node.url, createdNode.url); |
| 402 })); | 402 })); |
| 403 } | 403 } |
| 404 ]; | 404 ]; |
| 405 | 405 |
| 406 chrome.test.runTests(tests); | 406 chrome.test.runTests(tests); |
| OLD | NEW |