Commit bb384192 authored by Theresa Wellington's avatar Theresa Wellington Committed by Commit Bot

Create new helper method to openFolder in Bookmark*Tests

Some clean-up from nits in http://crrev.com/c/1929262.

BUG=1018170

Change-Id: Ib062e2ed3f512d3d3789099424534412519f5025
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1934449Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Theresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718798}
parent d613caac
...@@ -812,9 +812,7 @@ public class BookmarkReorderTest extends BookmarkTest { ...@@ -812,9 +812,7 @@ public class BookmarkReorderTest extends BookmarkTest {
openBookmarkManager(); openBookmarkManager();
// Open the new folder where these bookmarks were created. // Open the new folder where these bookmarks were created.
final BookmarkDelegate delegate = getBookmarkManager(); openFolder(folder);
TestThreadUtils.runOnUiThreadBlocking(() -> delegate.openFolder(folder));
RecyclerViewTestUtils.waitForStableRecyclerView(mItemsContainer);
Assert.assertEquals(1, getAdapter().getItemCount()); Assert.assertEquals(1, getAdapter().getItemCount());
BookmarkRow row = BookmarkRow row =
...@@ -855,9 +853,7 @@ public class BookmarkReorderTest extends BookmarkTest { ...@@ -855,9 +853,7 @@ public class BookmarkReorderTest extends BookmarkTest {
openBookmarkManager(); openBookmarkManager();
// Open the new folder where these bookmarks were created. // Open the new folder where these bookmarks were created.
final BookmarkDelegate delegate = getBookmarkManager(); openFolder(folder);
TestThreadUtils.runOnUiThreadBlocking(() -> delegate.openFolder(folder));
RecyclerViewTestUtils.waitForStableRecyclerView(mItemsContainer);
Assert.assertEquals(3, getAdapter().getItemCount()); Assert.assertEquals(3, getAdapter().getItemCount());
BookmarkRow row = BookmarkRow row =
...@@ -892,9 +888,7 @@ public class BookmarkReorderTest extends BookmarkTest { ...@@ -892,9 +888,7 @@ public class BookmarkReorderTest extends BookmarkTest {
openBookmarkManager(); openBookmarkManager();
// Open the new folder where these bookmarks were created. // Open the new folder where these bookmarks were created.
final BookmarkDelegate delegate = getBookmarkManager(); openFolder(folder);
TestThreadUtils.runOnUiThreadBlocking(() -> delegate.openFolder(folder));
RecyclerViewTestUtils.waitForStableRecyclerView(mItemsContainer);
Assert.assertEquals(3, getAdapter().getItemCount()); Assert.assertEquals(3, getAdapter().getItemCount());
BookmarkRow row = BookmarkRow row =
...@@ -929,9 +923,7 @@ public class BookmarkReorderTest extends BookmarkTest { ...@@ -929,9 +923,7 @@ public class BookmarkReorderTest extends BookmarkTest {
openBookmarkManager(); openBookmarkManager();
// Open the new folder where these bookmarks were created. // Open the new folder where these bookmarks were created.
final BookmarkDelegate delegate = getBookmarkManager(); openFolder(folder);
TestThreadUtils.runOnUiThreadBlocking(() -> delegate.openFolder(folder));
RecyclerViewTestUtils.waitForStableRecyclerView(mItemsContainer);
Assert.assertEquals(1, getAdapter().getItemCount()); Assert.assertEquals(1, getAdapter().getItemCount());
BookmarkRow row = BookmarkRow row =
......
...@@ -337,7 +337,7 @@ public class BookmarkTest { ...@@ -337,7 +337,7 @@ public class BookmarkTest {
final BookmarkDelegate delegate = getBookmarkManager(); final BookmarkDelegate delegate = getBookmarkManager();
// Open the new folder where these bookmarks were created. // Open the new folder where these bookmarks were created.
TestThreadUtils.runOnUiThreadBlocking(() -> delegate.openFolder(folder)); openFolder(folder);
Assert.assertEquals(BookmarkUIState.STATE_FOLDER, delegate.getCurrentState()); Assert.assertEquals(BookmarkUIState.STATE_FOLDER, delegate.getCurrentState());
Assert.assertEquals( Assert.assertEquals(
...@@ -387,7 +387,7 @@ public class BookmarkTest { ...@@ -387,7 +387,7 @@ public class BookmarkTest {
BookmarkManager manager = getBookmarkManager(); BookmarkManager manager = getBookmarkManager();
// Open the new folder where these bookmarks were created. // Open the new folder where these bookmarks were created.
TestThreadUtils.runOnUiThreadBlocking(() -> manager.openFolder(testFolder)); openFolder(testFolder);
Assert.assertEquals("Wrong state, should be in folder", BookmarkUIState.STATE_FOLDER, Assert.assertEquals("Wrong state, should be in folder", BookmarkUIState.STATE_FOLDER,
manager.getCurrentState()); manager.getCurrentState());
...@@ -594,4 +594,10 @@ public class BookmarkTest { ...@@ -594,4 +594,10 @@ public class BookmarkTest {
protected void searchBookmarks(final String query) { protected void searchBookmarks(final String query) {
TestThreadUtils.runOnUiThreadBlocking(() -> getBookmarkItemsAdapter().search(query)); TestThreadUtils.runOnUiThreadBlocking(() -> getBookmarkItemsAdapter().search(query));
} }
protected void openFolder(BookmarkId folder) {
final BookmarkDelegate delegate = getBookmarkManager();
TestThreadUtils.runOnUiThreadBlocking(() -> delegate.openFolder(folder));
RecyclerViewTestUtils.waitForStableRecyclerView(mItemsContainer);
}
} }
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