Commit b7adb589 authored by Friedrich Horschig's avatar Friedrich Horschig Committed by Commit Bot

Empty the passwords search results completely

This CL completely drops all UI elements that previously popped back
in when the results are empty.
Reason being, that
1. the link would redirect the user to the same passwords that are
 synced to the device they are using right now.
2. the "Saved passwords appear here" text would indicate that the user
 hasn't saved any passwords yet which is not correct. (Another text is
 not necessary as the interaction with the search field should give
 enough context for the empty list).

Bug: 807300,807302
Change-Id: Ice2dab3a5f6ee280a33ef559d540cc0ca6e082cc
Reviewed-on: https://chromium-review.googlesource.com/894002
Commit-Queue: Friedrich Horschig <fhorschig@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533237}
parent 8d3890cb
...@@ -500,8 +500,8 @@ public class SavePasswordsPreferences ...@@ -500,8 +500,8 @@ public class SavePasswordsPreferences
} }
mNoPasswords = profileCategory.getPreferenceCount() == 0; mNoPasswords = profileCategory.getPreferenceCount() == 0;
if (mNoPasswords) { if (mNoPasswords) {
displayManageAccountLink(); // Maybe the password is just not on the device. if (count == 0) displayEmptyScreenMessage(); // Show if the list was already empty.
displayEmptyScreenMessage(); getPreferenceScreen().removePreference(profileCategory);
} }
} }
......
...@@ -836,16 +836,16 @@ public class SavePasswordsPreferencesTest { ...@@ -836,16 +836,16 @@ public class SavePasswordsPreferencesTest {
@SmallTest @SmallTest
@Feature({"Preferences"}) @Feature({"Preferences"})
@EnableFeatures(ChromeFeatureList.PASSWORD_SEARCH) @EnableFeatures(ChromeFeatureList.PASSWORD_SEARCH)
public void testSearchDisplaysAccountLinkIfSearchTurnsUpEmpty() throws Exception { public void testSearchDisplaysBlankPageIfSearchTurnsUpEmpty() throws Exception {
setPasswordSourceWithMultipleEntries(GREEK_GODS); setPasswordSourceWithMultipleEntries(GREEK_GODS);
PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(),
SavePasswordsPreferences.class.getName()); SavePasswordsPreferences.class.getName());
Espresso.onView(withText(startsWith("View and manage"))).check(matches(isDisplayed()));
// Open the search which should hide the Account link. // Open the search which should hide the Account link.
Espresso.onView(withSearchMenuIdOrText()).perform(click()); Espresso.onView(withSearchMenuIdOrText()).perform(click());
Espresso.onView(withText(startsWith("View and manage"))).check(doesNotExist());
// Search for a string that matches nothing which should bring the Account link back. // Search for a string that matches nothing which should leave the results entirely blank.
Espresso.onView(withId(R.id.search_src_text)) Espresso.onView(withId(R.id.search_src_text))
.perform(click(), typeText("Mars"), closeSoftKeyboard()); .perform(click(), typeText("Mars"), closeSoftKeyboard());
...@@ -853,7 +853,9 @@ public class SavePasswordsPreferencesTest { ...@@ -853,7 +853,9 @@ public class SavePasswordsPreferencesTest {
Espresso.onView(allOf(withText(god.getUserName()), withText(god.getUrl()))) Espresso.onView(allOf(withText(god.getUserName()), withText(god.getUrl())))
.check(doesNotExist()); .check(doesNotExist());
} }
Espresso.onView(withText(startsWith("View and manage"))).check(matches(isDisplayed())); Espresso.onView(withText(startsWith("View and manage"))).check(doesNotExist());
Espresso.onView(withText(R.string.saved_passwords_none_text)).check(doesNotExist());
Espresso.onView(withText(R.string.section_saved_passwords)).check(doesNotExist());
} }
/** /**
......
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