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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java

Issue 2632493003: [Android History] Styling changes (Closed)
Patch Set: Created 3 years, 11 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
Index: chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java
index f4d554e4cb5e67b8d29972404cd12ba8b99c5910..c64a89d5fc151e6005e5645788593616f8dc4f5b 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java
@@ -344,6 +344,68 @@ public class HistoryActivityTest extends BaseActivityInstrumentationTestCase<His
signOut();
}
+ @SmallTest
+ public void testToolbarShadow() throws Exception {
+ View toolbarShadow = mHistoryManager.getToolbarShadowForTests();
+ assertEquals(View.GONE, toolbarShadow.getVisibility());
+
+ toggleItemSelection(2);
+ assertTrue(mHistoryManager.getSelectionDelegateForTests().isSelectionEnabled());
+ assertEquals(View.VISIBLE, toolbarShadow.getVisibility());
+
+ toggleItemSelection(2);
+ assertFalse(mHistoryManager.getSelectionDelegateForTests().isSelectionEnabled());
+ assertEquals(View.GONE, toolbarShadow.getVisibility());
+ }
+
+ @SmallTest
+ public void testSearchView() throws Exception {
+ final HistoryManagerToolbar toolbar = mHistoryManager.getToolbarForTests();
+ View toolbarShadow = mHistoryManager.getToolbarShadowForTests();
+ View toolbarSearchView = toolbar.getSearchViewForTests();
+ assertEquals(View.GONE, toolbarShadow.getVisibility());
+ assertEquals(View.GONE, toolbarSearchView.getVisibility());
+
+ toggleItemSelection(2);
+ assertTrue(mHistoryManager.getSelectionDelegateForTests().isSelectionEnabled());
+
+ int callCount = mTestObserver.onSelectionCallback.getCallCount();
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ toolbar.getMenu().performIdentifierAction(R.id.search_menu_id, 0);
+ }
+ });
+
+ // The selection should be cleared when a search is started.
+ mTestObserver.onSelectionCallback.waitForCallback(callCount, 1);
+ assertFalse(mHistoryManager.getSelectionDelegateForTests().isSelectionEnabled());
+ assertEquals(View.VISIBLE, toolbarShadow.getVisibility());
+ assertEquals(View.VISIBLE, toolbarSearchView.getVisibility());
+
+ // Select an item and assert that the search view is no longer showing.
+ toggleItemSelection(2);
+ assertTrue(mHistoryManager.getSelectionDelegateForTests().isSelectionEnabled());
+ assertEquals(View.VISIBLE, toolbarShadow.getVisibility());
+ assertEquals(View.GONE, toolbarSearchView.getVisibility());
+
+ // Clear the selection and assert that the search view is showing again.
+ toggleItemSelection(2);
+ assertFalse(mHistoryManager.getSelectionDelegateForTests().isSelectionEnabled());
+ assertEquals(View.VISIBLE, toolbarShadow.getVisibility());
+ assertEquals(View.VISIBLE, toolbarSearchView.getVisibility());
+
+ // Close the search view.
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ toolbar.onNavigationBack();
+ }
+ });
+ assertEquals(View.GONE, toolbarShadow.getVisibility());
+ assertEquals(View.GONE, toolbarSearchView.getVisibility());
+ }
+
private void toggleItemSelection(int position) throws Exception {
int callCount = mTestObserver.onSelectionCallback.getCallCount();
final SelectableItemView<HistoryItem> itemView = getItemView(position);

Powered by Google App Engine
This is Rietveld 408576698