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

Unified Diff: chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java

Issue 2289803002: Fix BookmarksTest#testDownloadMovedBookmark to be insensitive to item order. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add tracking bug for explicit bookmark order Created 4 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java
index 96c1a216876aa9438bca510f28066ed4a814a80f..fe046f3bfbe43f46dc959ce4f9d8f836476ffa14 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java
@@ -159,20 +159,30 @@ public class BookmarksTest extends SyncTestBase {
SyncTestUtil.triggerSync();
waitForClientBookmarkCount(2);
- // The folder comes first because new entities are inserted at index 0.
- final Bookmark folder = getClientBookmarks().get(0);
- Bookmark bookmark = getClientBookmarks().get(1);
- assertTrue(folder.isFolder());
- assertFalse(bookmark.isFolder());
-
- // Move on server, sync, and verify the move locally.
+ // We should have exactly two (2) bookmark items: one a folder and the
+ // other a bookmark. We need to figure out which is which because the
+ // order is not being explicitly set on creation.
+ //
+ // See http://crbug/642128 - Explicitly set order on bookmark creation
+ // and verify the order here.
+ List<Bookmark> clientBookmarks = getClientBookmarks();
+ assertEquals(2, clientBookmarks.size());
+ Bookmark item0 = clientBookmarks.get(0);
+ Bookmark item1 = clientBookmarks.get(1);
+ assertTrue(item0.isFolder() != item1.isFolder());
+ final int bookmarkIndex = item0.isFolder() ? 1 : 0;
+ final Bookmark folder = item0.isFolder() ? item0 : item1;
+ final Bookmark bookmark = item0.isFolder() ? item1 : item0;
+
+ // On the server, move the bookmark into the folder then sync, and
+ // verify the move locally.
mFakeServerHelper.modifyBookmarkEntity(bookmark.id, TITLE, URL, folder.id);
SyncTestUtil.triggerSync();
pollInstrumentationThread(new ClientBookmarksCriteria() {
@Override
public boolean isSatisfied(List<Bookmark> bookmarks) {
// The "s" is prepended because the server adds one to the parentId.
- return bookmarks.get(1).parentId.equals("s" + folder.id);
+ return bookmarks.get(bookmarkIndex).parentId.equals("s" + folder.id);
}
});
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698