| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/login/quick_unlock/fingerprint_storage.h" |
| 5 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" | 6 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" |
| 6 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" | 7 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" |
| 7 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" | 8 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" |
| 8 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
| 9 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| 10 #include "components/prefs/pref_service.h" | 11 #include "components/prefs/pref_service.h" |
| 11 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 14 |
| 14 namespace chromeos { | 15 namespace chromeos { |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 class FingerprintStorageUnitTest : public testing::Test { | 18 class FingerprintStorageUnitTest : public testing::Test { |
| 18 protected: | 19 protected: |
| 19 FingerprintStorageUnitTest() : profile_(new TestingProfile()) {} | 20 FingerprintStorageUnitTest() : profile_(new TestingProfile()) {} |
| 20 ~FingerprintStorageUnitTest() override {} | 21 ~FingerprintStorageUnitTest() override {} |
| 21 | 22 |
| 22 // testing::Test: | 23 // testing::Test: |
| 23 void SetUp() override { quick_unlock::EnableForTesting(); } | 24 void SetUp() override { |
| 25 quick_unlock::EnableForTesting(quick_unlock::PinStorageProvider::Prefs); |
| 26 } |
| 24 | 27 |
| 25 content::TestBrowserThreadBundle thread_bundle_; | 28 content::TestBrowserThreadBundle thread_bundle_; |
| 26 std::unique_ptr<TestingProfile> profile_; | 29 std::unique_ptr<TestingProfile> profile_; |
| 27 | 30 |
| 28 DISALLOW_COPY_AND_ASSIGN(FingerprintStorageUnitTest); | 31 DISALLOW_COPY_AND_ASSIGN(FingerprintStorageUnitTest); |
| 29 }; | 32 }; |
| 30 | 33 |
| 31 } // namespace | 34 } // namespace |
| 32 | 35 |
| 33 // Provides test-only FingerprintStorage APIs. | 36 // Provides test-only FingerprintStorage APIs. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 for (int i = 0; i < quick_unlock::FingerprintStorage::kMaximumUnlockAttempts; | 101 for (int i = 0; i < quick_unlock::FingerprintStorage::kMaximumUnlockAttempts; |
| 99 ++i) { | 102 ++i) { |
| 100 fingerprint_storage->AddUnlockAttempt(); | 103 fingerprint_storage->AddUnlockAttempt(); |
| 101 } | 104 } |
| 102 EXPECT_FALSE(test_api.IsFingerprintAuthenticationAvailable()); | 105 EXPECT_FALSE(test_api.IsFingerprintAuthenticationAvailable()); |
| 103 fingerprint_storage->ResetUnlockAttemptCount(); | 106 fingerprint_storage->ResetUnlockAttemptCount(); |
| 104 EXPECT_TRUE(test_api.IsFingerprintAuthenticationAvailable()); | 107 EXPECT_TRUE(test_api.IsFingerprintAuthenticationAvailable()); |
| 105 } | 108 } |
| 106 | 109 |
| 107 } // namespace chromeos | 110 } // namespace chromeos |
| OLD | NEW |