Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/bookmarks/BookmarkModelUnitTest.java

Issue 1774783002: Fix a bug in bookmark filtering, add a test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a bug in bookmark filtering. add tests. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkModel.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/junit/src/org/chromium/chrome/browser/bookmarks/BookmarkModelUnitTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/bookmarks/BookmarkModelUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/bookmarks/BookmarkModelUnitTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..5126009f458583a267047d1d0153d56ecba90f59
--- /dev/null
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/bookmarks/BookmarkModelUnitTest.java
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.bookmarks;
+
+import static org.junit.Assert.assertEquals;
+
+import org.chromium.base.BaseChromiumApplication;
+import org.chromium.chrome.browser.offlinepages.ClientId;
+import org.chromium.components.bookmarks.BookmarkId;
+import org.chromium.components.bookmarks.BookmarkType;
+import org.chromium.testing.local.LocalRobolectricTestRunner;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.annotation.Config;
+
+/**
+ * Robolectric tests for {@link BookmarkUtils}.
+ */
+@RunWith(LocalRobolectricTestRunner.class)
+@Config(manifest = Config.NONE, application = BaseChromiumApplication.class)
+public class BookmarkModelUnitTest {
+ @Test
+ public void testGetBookmarkIdForOfflineClientIdBadId() {
+ ClientId clientId = new ClientId("bookmark", "id");
+ BookmarkId id = BookmarkModel.getBookmarkIdForOfflineClientId(clientId);
+
+ assertEquals(id.getType(), BookmarkType.NORMAL);
+ assertEquals(id.getId(), -1);
+ }
+
+ @Test
+ public void testGetBookmarkIdForOfflineClientIdWrongNamespace() {
+ ClientId clientId = new ClientId("wrong", "6");
+ BookmarkId id = BookmarkModel.getBookmarkIdForOfflineClientId(clientId);
+
+ assertEquals(id.getType(), BookmarkType.NORMAL);
+ assertEquals(id.getId(), -1);
+ }
+
+ @Test
+ public void testGetBookmarkIdForOfflineClientIdOk() {
+ ClientId clientId = new ClientId("bookmark", "6");
+ BookmarkId id = BookmarkModel.getBookmarkIdForOfflineClientId(clientId);
+
+ assertEquals(id.getType(), BookmarkType.NORMAL);
+ assertEquals(id.getId(), 6);
+ }
+}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkModel.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698