Index: chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc |
diff --git a/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc b/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc |
index f3a306c6ccf5ab25c2c5ebe2a7bede9a4e88da90..3109378a50b17463c05f91819a56a8886b31914d 100644 |
--- a/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc |
+++ b/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc |
@@ -18,7 +18,12 @@ namespace chromeos { |
namespace quick_unlock { |
namespace { |
+// Quick unlock is enabled regardless of flags. |
bool enable_for_testing_ = false; |
+// If testing is enabled, PIN will use prefs as backend. Otherwise, it will use |
+// cryptohome. |
+PinStorageProvider testing_pin_storage_provider_ = PinStorageProvider::Prefs; |
+ |
// Options for the quick unlock whitelist. |
const char kQuickUnlockWhitelistOptionAll[] = "all"; |
const char kQuickUnlockWhitelistOptionPin[] = "PIN"; |
@@ -87,6 +92,15 @@ bool IsPinEnabled(PrefService* pref_service) { |
return base::FeatureList::IsEnabled(features::kQuickUnlockPin); |
} |
+PinStorageProvider GetPinStorageProvider() { |
+ if (enable_for_testing_) |
+ return testing_pin_storage_provider_; |
+ |
+ if (base::FeatureList::IsEnabled(features::kQuickUnlockPinSignin)) |
+ return PinStorageProvider::Cryptohome; |
+ return PinStorageProvider::Prefs; |
+} |
+ |
bool IsFingerprintEnabled() { |
if (enable_for_testing_) |
return true; |
@@ -95,8 +109,9 @@ bool IsFingerprintEnabled() { |
return base::FeatureList::IsEnabled(features::kQuickUnlockFingerprint); |
} |
-void EnableForTesting() { |
+void EnableForTesting(PinStorageProvider pin_storage_provider) { |
enable_for_testing_ = true; |
+ testing_pin_storage_provider_ = pin_storage_provider; |
} |
} // namespace quick_unlock |