[go: nahoru, domu]

cros: Log authentication stage in LoginScreenController::OnShow.

There was one crash report in this method, but the crash did not seem to include
local variables. Log the value of authentication_stage_ to capture it.

Bug: 820671
Change-Id: I82c25b8a58f0993a9eef94c497c2c3e06c48b255
Reviewed-on: https://chromium-review.googlesource.com/1015880
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553372}
diff --git a/ash/login/login_screen_controller.cc b/ash/login/login_screen_controller.cc
index fe23d37..ac2162ca 100644
--- a/ash/login/login_screen_controller.cc
+++ b/ash/login/login_screen_controller.cc
@@ -11,6 +11,7 @@
 #include "ash/session/session_controller.h"
 #include "ash/shell.h"
 #include "ash/system/status_area_widget.h"
+#include "base/debug/alias.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chromeos/cryptohome/system_salt_getter.h"
@@ -87,7 +88,7 @@
                                              OnAuthenticateCallback callback) {
   // It is an error to call this function while an authentication is in
   // progress.
-  LOG_IF(ERROR, authentication_stage_ == AuthenticationStage::kIdle)
+  LOG_IF(ERROR, authentication_stage_ != AuthenticationStage::kIdle)
       << "Authentication stage is " << static_cast<int>(authentication_stage_);
   CHECK_EQ(authentication_stage_, AuthenticationStage::kIdle);
 
@@ -420,7 +421,12 @@
 
 void LoginScreenController::OnShow() {
   SetSystemTrayVisibility(SystemTrayVisibility::kPrimary);
-  CHECK_EQ(authentication_stage_, AuthenticationStage::kIdle);
+  if (authentication_stage_ != AuthenticationStage::kIdle) {
+    AuthenticationStage authentication_stage = authentication_stage_;
+    base::debug::Alias(&authentication_stage);
+    LOG(FATAL) << "Unexpected authentication stage "
+               << static_cast<int>(authentication_stage_);
+  }
 }
 
 }  // namespace ash