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); |
} |
}); |
} |