[go: nahoru, domu]

cros: Add debug option to force-fail auth on views-based lock.

Force-fail auth is useful when testing auth on the desktop, as the fake
cryptohome will accept any password.

Bug: 719015
Change-Id: I648493f1d65aa2b4f9aeb0626566ae1c1412e210
Reviewed-on: https://chromium-review.googlesource.com/702594
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#508116}
diff --git a/ash/login/lock_screen_controller.cc b/ash/login/lock_screen_controller.cc
index 5e9de90f..73777c1 100644
--- a/ash/login/lock_screen_controller.cc
+++ b/ash/login/lock_screen_controller.cc
@@ -111,6 +111,13 @@
   if (!lock_screen_client_)
     return;
 
+  // If auth is disabled by the debug overlay bypass the mojo call entirely, as
+  // it will dismiss the lock screen if the password is correct.
+  if (force_fail_auth_for_debug_overlay_) {
+    std::move(callback).Run(false);
+    return;
+  }
+
   // We cannot execute auth requests directly via GetSystemSalt because it
   // expects a base::Callback instance, but |callback| is a base::OnceCallback.
   // Instead, we store |callback| on this object and invoke it locally once we