Commit e7d6cad2 authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Signin][Android] Add empty onDismiss method to AccountPickerDelegate

This CL adds an empty method onDismiss to AccountPickerDelegate so we
can release resources in this method later when working with
WebSigninBridge.

Bug: 1093741
Change-Id: Ibcea89c360431e102115faa3e7b34eb435253252
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339514Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795363}
parent 418d2506
...@@ -84,6 +84,7 @@ class AccountPickerBottomSheetMediator implements AccountPickerCoordinator.Liste ...@@ -84,6 +84,7 @@ class AccountPickerBottomSheetMediator implements AccountPickerCoordinator.Liste
} }
void destroy() { void destroy() {
mAccountPickerDelegate.onDismiss();
mProfileDataCache.removeObserver(mProfileDataSourceObserver); mProfileDataCache.removeObserver(mProfileDataSourceObserver);
mAccountManagerFacade.removeObserver(mAccountsChangeObserver); mAccountManagerFacade.removeObserver(mAccountsChangeObserver);
} }
......
...@@ -47,6 +47,14 @@ public class AccountPickerDelegate { ...@@ -47,6 +47,14 @@ public class AccountPickerDelegate {
mSigninManager = IdentityServicesProvider.get().getSigninManager( mSigninManager = IdentityServicesProvider.get().getSigninManager(
Profile.getLastUsedRegularProfile()); Profile.getLastUsedRegularProfile());
} }
/**
* Releases resources used by this class.
*/
public void onDismiss() {
// TODO(https://crbug.com/1093741): Destroys WebSigninBridge in the delegate
}
/** /**
* Signs the user into the account of the given accountName. * Signs the user into the account of the given accountName.
*/ */
......
...@@ -195,6 +195,7 @@ public class AccountPickerBottomSheetTest { ...@@ -195,6 +195,7 @@ public class AccountPickerBottomSheetTest {
Assert.assertEquals(2, mFakeProfileDataSource.getNumberOfObservers()); Assert.assertEquals(2, mFakeProfileDataSource.getNumberOfObservers());
onView(isRoot()).perform(pressBack()); onView(isRoot()).perform(pressBack());
Assert.assertFalse(controller.isSheetOpen()); Assert.assertFalse(controller.isSheetOpen());
verify(mAccountPickerDelegateMock).onDismiss();
Assert.assertEquals(0, mFakeProfileDataSource.getNumberOfObservers()); Assert.assertEquals(0, mFakeProfileDataSource.getNumberOfObservers());
} }
...@@ -207,6 +208,7 @@ public class AccountPickerBottomSheetTest { ...@@ -207,6 +208,7 @@ public class AccountPickerBottomSheetTest {
Assert.assertEquals(2, mFakeProfileDataSource.getNumberOfObservers()); Assert.assertEquals(2, mFakeProfileDataSource.getNumberOfObservers());
onView(isRoot()).perform(pressBack()); onView(isRoot()).perform(pressBack());
Assert.assertFalse(controller.isSheetOpen()); Assert.assertFalse(controller.isSheetOpen());
verify(mAccountPickerDelegateMock).onDismiss();
Assert.assertEquals(0, mFakeProfileDataSource.getNumberOfObservers()); Assert.assertEquals(0, mFakeProfileDataSource.getNumberOfObservers());
} }
......
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