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 // bookmarks api test | 5 // bookmarks api test |
6 // browser_tests.exe --gtest_filter=ExtensionApiTest.Bookmarks | 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.Bookmarks |
7 | 7 |
8 // This is global state that is maintained across tests as a reference | 8 // This is global state that is maintained across tests as a reference |
9 // to compare against what's fetched from the browser (using compareTrees). | 9 // to compare against what's fetched from the browser (using compareTrees). |
10 // TODO(erikkay) It would be better if each test was self-contained and | 10 // TODO(erikkay) It would be better if each test was self-contained and |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 chrome.bookmarks.search("www hello", pass(function(results) { | 294 chrome.bookmarks.search("www hello", pass(function(results) { |
295 // matches node1 & node3 | 295 // matches node1 & node3 |
296 chrome.test.assertEq(2, results.length); | 296 chrome.test.assertEq(2, results.length); |
297 })); | 297 })); |
298 chrome.bookmarks.search("bar example", | 298 chrome.bookmarks.search("bar example", |
299 pass(function(results) { | 299 pass(function(results) { |
300 // matches node2 | 300 // matches node2 |
301 chrome.test.assertEq(1, results.length); | 301 chrome.test.assertEq(1, results.length); |
302 })); | 302 })); |
303 chrome.bookmarks.search("foo bar", pass(function(results) { | 303 chrome.bookmarks.search("foo bar", pass(function(results) { |
304 // matches node1 | 304 // matches node1 & folder "foo bar" from createFolder |
305 chrome.test.assertEq(1, results.length); | 305 chrome.test.assertEq(2, results.length); |
306 })); | 306 })); |
307 chrome.bookmarks.search("quux", pass(function(results) { | 307 chrome.bookmarks.search("quux", pass(function(results) { |
308 // matches node2 & node3 | 308 // matches node2 & node3 |
309 chrome.test.assertEq(2, results.length); | 309 chrome.test.assertEq(2, results.length); |
310 })); | 310 })); |
311 }, | 311 }, |
312 | 312 |
313 function update() { | 313 function update() { |
314 var title = "hello world"; | 314 var title = "hello world"; |
315 chrome.test.listenOnce(chrome.bookmarks.onChanged, function(id, changes) { | 315 chrome.test.listenOnce(chrome.bookmarks.onChanged, function(id, changes) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 "Should only get the last 2 bookmarks"); | 483 "Should only get the last 2 bookmarks"); |
484 | 484 |
485 chrome.test.assertTrue(compareNode(node3, results[0])); | 485 chrome.test.assertTrue(compareNode(node3, results[0])); |
486 chrome.test.assertTrue(compareNode(node2, results[1])); | 486 chrome.test.assertTrue(compareNode(node2, results[1])); |
487 })); | 487 })); |
488 } | 488 } |
489 ]); | 489 ]); |
490 } | 490 } |
491 | 491 |
492 run(); | 492 run(); |
OLD | NEW |