Commit 582aaa86 authored by Friedrich Horschig's avatar Friedrich Horschig Committed by Commit Bot

Restore save password preferences with aborted search

When the search view is collapsed, the search should be reset entirely.

Bug: 807574, 807306
Change-Id: Id13eb9e119459d05751e06b515671eccacc776f2
Reviewed-on: https://chromium-review.googlesource.com/895485Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Friedrich Horschig <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533289}
parent 0b4af239
...@@ -189,6 +189,7 @@ public class SavePasswordsPreferences ...@@ -189,6 +189,7 @@ public class SavePasswordsPreferences
@Override @Override
public boolean onMenuItemActionCollapse(MenuItem menuItem) { public boolean onMenuItemActionCollapse(MenuItem menuItem) {
searchView.setQuery(null, false);
filterPasswords(null); // Reset filter to bring back all preferences. filterPasswords(null); // Reset filter to bring back all preferences.
return true; // Continue collapsing. return true; // Continue collapsing.
} }
......
...@@ -921,12 +921,14 @@ public class SavePasswordsPreferencesTest { ...@@ -921,12 +921,14 @@ public class SavePasswordsPreferencesTest {
@SmallTest @SmallTest
@Feature({"Preferences"}) @Feature({"Preferences"})
@EnableFeatures(ChromeFeatureList.PASSWORD_SEARCH) @EnableFeatures(ChromeFeatureList.PASSWORD_SEARCH)
public void testSearchBarBackButtonBringsBackGeneralPrefs() throws Exception { public void testSearchBarBackButtonRestoresGeneralPrefs() throws Exception {
setPasswordSourceWithMultipleEntries(GREEK_GODS); setPasswordSourceWithMultipleEntries(GREEK_GODS);
PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(),
SavePasswordsPreferences.class.getName()); SavePasswordsPreferences.class.getName());
Espresso.onView(withSearchMenuIdOrText()).perform(click()); Espresso.onView(withSearchMenuIdOrText()).perform(click());
Espresso.onView(withId(R.id.search_src_text))
.perform(click(), typeText("Zeu"), closeSoftKeyboard());
Espresso.onView(withText(R.string.passwords_auto_signin_title)).check(doesNotExist()); Espresso.onView(withText(R.string.passwords_auto_signin_title)).check(doesNotExist());
Espresso.onView(withText(startsWith("View and manage"))).check(doesNotExist()); Espresso.onView(withText(startsWith("View and manage"))).check(doesNotExist());
...@@ -947,12 +949,14 @@ public class SavePasswordsPreferencesTest { ...@@ -947,12 +949,14 @@ public class SavePasswordsPreferencesTest {
@SmallTest @SmallTest
@Feature({"Preferences"}) @Feature({"Preferences"})
@EnableFeatures(ChromeFeatureList.PASSWORD_SEARCH) @EnableFeatures(ChromeFeatureList.PASSWORD_SEARCH)
public void testSearchBarBackKeyBringsBackGeneralPrefs() throws Exception { public void testSearchBarBackKeyRestoresGeneralPrefs() throws Exception {
setPasswordSourceWithMultipleEntries(GREEK_GODS); setPasswordSourceWithMultipleEntries(GREEK_GODS);
PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(), PreferencesTest.startPreferences(InstrumentationRegistry.getInstrumentation(),
SavePasswordsPreferences.class.getName()); SavePasswordsPreferences.class.getName());
Espresso.onView(withSearchMenuIdOrText()).perform(click()); Espresso.onView(withSearchMenuIdOrText()).perform(click());
Espresso.onView(withId(R.id.search_src_text))
.perform(click(), typeText("Zeu"), closeSoftKeyboard());
Espresso.onView(withText(R.string.passwords_auto_signin_title)).check(doesNotExist()); Espresso.onView(withText(R.string.passwords_auto_signin_title)).check(doesNotExist());
Espresso.onView(withText(startsWith("View and manage"))).check(doesNotExist()); Espresso.onView(withText(startsWith("View and manage"))).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