Commit ba2e922d authored by Victor-Gabriel Savu's avatar Victor-Gabriel Savu Committed by Commit Bot

oobe: fix fake enterprise enrollment login

Allow fake login to continue without an OAuth cookie to fix the
fake enterprise enrollment.

Bug: chromium:1140422
Test: tast run <ip> policy.SystemTimezone
Change-Id: I75985607421c370c610336b1afbcf5b7c708da89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2487268
Commit-Queue: Victor-Gabriel Savu <vsavu@google.com>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818960}
parent d6ea80a0
......@@ -735,6 +735,7 @@ void EnrollmentScreenHandler::HandleToggleFakeEnrollment() {
VLOG(1) << "HandleToggleFakeEnrollment";
policy::PolicyOAuth2TokenFetcher::UseFakeTokensForTesting();
WizardController::SkipEnrollmentPromptsForTesting();
use_fake_login_for_testing_ = true;
}
void EnrollmentScreenHandler::HandleClose(const std::string& reason) {
......@@ -825,8 +826,10 @@ void EnrollmentScreenHandler::OnGetCookiesForCompleteLogin(
}
}
if (auth_code.empty()) {
// Allow testing to continue without a oauth cookie.
if (auth_code.empty() && !use_fake_login_for_testing_) {
// Will try again from oauth_code_waiter callback.
VLOG(1) << "OAuth cookie empty, still waiting";
return;
}
......@@ -836,6 +839,7 @@ void EnrollmentScreenHandler::OnGetCookiesForCompleteLogin(
}
void EnrollmentScreenHandler::OnCookieWaitTimeout() {
LOG(ERROR) << "Timeout waiting for OAuth cookie";
oauth_code_waiter_.reset();
ShowError(IDS_LOGIN_FATAL_ERROR_NO_AUTH_TOKEN, true);
}
......
......@@ -194,6 +194,8 @@ class EnrollmentScreenHandler
std::unique_ptr<CookieWaiter> oauth_code_waiter_;
bool use_fake_login_for_testing_ = false;
base::WeakPtrFactory<EnrollmentScreenHandler> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenHandler);
......
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