Commit a6e7eef0 authored by Boris Sazonov's avatar Boris Sazonov Committed by Commit Bot

[Signin][Android] Remove onPolicyFetchedBeforeSignIn

Bug: None
Change-Id: I44ce5e128389a0a64f310e5b6d9d26a0ae231710
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1823118
Auto-Submit: Boris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarPâris Meuleman <pmeuleman@chromium.org>
Reviewed-by: default avatarAlex Ilin <alexilin@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700302}
parent 4f49f218
......@@ -451,19 +451,16 @@ public class SigninManager
assert mSignInState.mCoreAccountInfo != null;
Log.d(TAG, "Checking if account has policy management enabled");
fetchAndApplyCloudPolicy(mSignInState.mCoreAccountInfo, this::onPolicyFetchedBeforeSignIn);
fetchAndApplyCloudPolicy(
mSignInState.mCoreAccountInfo, this::finishSignInAfterPolicyEnforced);
}
@VisibleForTesting
/**
* If the user is managed, its policy has been fetched and is being enforced; features like sync
* may now be disabled by policy, and the rest of the sign-in flow can be resumed.
* Finishes the sign-in flow. If the user is managed, the policy should be fetched and enforced
* before calling this method.
*/
void onPolicyFetchedBeforeSignIn() {
finishSignIn();
}
private void finishSignIn() {
@VisibleForTesting
void finishSignInAfterPolicyEnforced() {
// This method should be called at most once per sign-in flow.
assert mSignInState != null && mSignInState.mCoreAccountInfo != null;
......
......@@ -245,7 +245,7 @@ public class SigninManagerTest {
mSigninManager.runAfterOperationInProgress(callCount::incrementAndGet);
assertEquals(0, callCount.get());
mSigninManager.onPolicyFetchedBeforeSignIn();
mSigninManager.finishSignInAfterPolicyEnforced();
assertFalse(mSigninManager.isOperationInProgress());
assertEquals(1, callCount.get());
}
......
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