Commit 4ef269d9 authored by Xing Liu's avatar Xing Liu Committed by Chromium LUCI CQ

Read later: Add BookmarkBridgeTest.addToReadingList.

BookmarkBridge.addToReadingList is not covered.

This is also part of a reland for:
https://chromium-review.googlesource.com/c/chromium/src/+/2625276

Bug: 1166251
Change-Id: Ib6ad34b4daa935151c4895d43fc0eee292727787
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2627771
Commit-Queue: Xing Liu <xingliu@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844973}
parent 9a823ced
......@@ -17,11 +17,15 @@ import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.UiThreadTest;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.RequiresRestart;
import org.chromium.chrome.browser.bookmarks.BookmarkBridge.BookmarkItem;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.test.ChromeBrowserTestRule;
import org.chromium.chrome.test.util.BookmarkTestUtil;
import org.chromium.chrome.test.util.browser.Features;
import org.chromium.components.bookmarks.BookmarkId;
import org.chromium.components.bookmarks.BookmarkType;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.url.GURL;
......@@ -323,4 +327,24 @@ public class BookmarkBridgeTest {
+ "over partner bookmarks",
expectedSearchResults, searchResults);
}
@Test
@SmallTest
@UiThreadTest
@Features.EnableFeatures({ChromeFeatureList.READ_LATER})
@RequiresRestart
public void testAddToReadingList() {
Assert.assertNull("Should return null for non http/https URLs.",
mBookmarkBridge.addToReadingList("a", new GURL("chrome://flags")));
BookmarkId readingListId =
mBookmarkBridge.addToReadingList("a", new GURL("https://www.google.com/"));
Assert.assertNotNull("Failed to add to reading list", readingListId);
Assert.assertEquals(BookmarkType.READING_LIST, readingListId.getType());
BookmarkItem readingListItem =
mBookmarkBridge.getReadingListItem(new GURL("https://www.google.com/"));
Assert.assertNotNull("Failed to find the reading list", readingListItem);
Assert.assertEquals(
"https://www.google.com/", readingListItem.getUrl().getValidSpecOrEmpty());
Assert.assertEquals("a", readingListItem.getTitle());
}
}
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