Logo Search packages:      
Sourcecode: chromium-browser version File versions  Download package

def bookmarks::BookmarksTest::testOrdering (   self  ) 

Add/delete a set of bookmarks, and verify their ordering.

Definition at line 280 of file bookmarks.py.

00280                         :
    """Add/delete a set of bookmarks, and verify their ordering."""
    bookmarks = self.GetBookmarkModel()
    bar_id = bookmarks.BookmarkBar()['id']
    orig_nodes_count = bookmarks.NodeCount()

    url_data = self._GetTestURLs("urls_and_titles")
    list_of_titles = url_data.values()

    for index, (url, name) in enumerate(url_data.iteritems()):
      self.AddBookmarkURL(bar_id, index, name, url)

    # check that we added them correctly
    bookmarks = self.GetBookmarkModel()
    self.assertEqual(orig_nodes_count + len(url_data) , bookmarks.NodeCount())

    for node, (url, name) in zip(bookmarks.BookmarkBar()['children'],
      self.assertEqual(node['type'], 'url')
      self.assertEqual(node['name'], name)
      self.assertEqual(node['url'], url)

    # remove a few of them.
    remove_indices = [3, 5, 9, 12]
    new_list_of_titles = list_of_titles[:]
    assert len(remove_indices) <= len(url_data) and \
           max(remove_indices) < len(url_data)

    for index in remove_indices:
      node = bookmarks.FindByTitle(list_of_titles[index])
    logging.debug('Removed: %s' % [list_of_titles[x] for x in remove_indices])

    # Confirm removal.
    bookmarks = self.GetBookmarkModel()
    for index in remove_indices:
      nodes = bookmarks.FindByTitle(list_of_titles[index])
      self.assertEqual(0, len(nodes))

    # Confirm that other bookmarks were not removed and their order is intact.
    for title, node in zip(new_list_of_titles,
      self.assertEqual(title, node['name'])

  def testDeepNesting(self):

Generated by  Doxygen 1.6.0   Back to index