Commit ad8f1cad authored by ianwen's avatar ianwen Committed by Commit bot

Add tests to EnhancedBookmarksModel

Enhanced bookmark model is the data abstraction layer of enhanced bookmark.

This CL also fixes the bug that add folder returns a wrong bookmarkid.

BUG=458632, 458703

Review URL: https://codereview.chromium.org/929523002

Cr-Commit-Position: refs/heads/master@{#318718}
parent 89f0fd6d
......@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.enhanced_bookmarks;
import org.chromium.base.ObserverList;
import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.browser.BookmarksBridge;
import org.chromium.chrome.browser.BookmarksBridge.BookmarkItem;
import org.chromium.chrome.browser.BookmarksBridge.BookmarkModelObserver;
......@@ -63,6 +64,12 @@ public class EnhancedBookmarksModel {
this();
}
@VisibleForTesting
EnhancedBookmarksModel(Profile profile) {
mBookmarksBridge = new BookmarksBridge(profile);
mEnhancedBookmarksBridge = new EnhancedBookmarksBridge(profile);
}
/**
* Clean up all the bridges. This must be called after done using this class.
*/
......@@ -275,7 +282,8 @@ public class EnhancedBookmarksModel {
}
/**
* @see EnhancedBookmarksBridge#moveBookmark(BookmarkId, BookmarkId)
* Calls {@link EnhancedBookmarksBridge#moveBookmark(BookmarkId, BookmarkId)} in a reversed
* order of the list, in order to let the last item appear at the top.
*/
public void moveBookmarks(List<BookmarkId> bookmarkIds, BookmarkId newParentId) {
for (int i = bookmarkIds.size() - 1; i >= 0; i--) {
......@@ -394,4 +402,12 @@ public class EnhancedBookmarksModel {
public void removeSearchObserver(SearchServiceObserver observer) {
mEnhancedBookmarksBridge.removeSearchObserver(observer);
}
/**
* @see BookmarksBridge#loadEmptyPartnerBookmarkShimForTesting()
*/
@VisibleForTesting
public void loadEmptyPartnerBookmarkShimForTesting() {
mBookmarksBridge.loadEmptyPartnerBookmarkShimForTesting();
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment