| 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_(base::MakeUnique<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::PinStorageType::kPrefs); |
| 26 } |
| 24 | 27 |
| 25 void SetRecords(int records_number) { | 28 void SetRecords(int records_number) { |
| 26 profile_->GetPrefs()->SetInteger(prefs::kQuickUnlockFingerprintRecord, | 29 profile_->GetPrefs()->SetInteger(prefs::kQuickUnlockFingerprintRecord, |
| 27 records_number); | 30 records_number); |
| 28 } | 31 } |
| 29 | 32 |
| 30 content::TestBrowserThreadBundle thread_bundle_; | 33 content::TestBrowserThreadBundle thread_bundle_; |
| 31 std::unique_ptr<TestingProfile> profile_; | 34 std::unique_ptr<TestingProfile> profile_; |
| 32 | 35 |
| 33 DISALLOW_COPY_AND_ASSIGN(FingerprintStorageUnitTest); | 36 DISALLOW_COPY_AND_ASSIGN(FingerprintStorageUnitTest); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 for (int i = 0; i < quick_unlock::FingerprintStorage::kMaximumUnlockAttempts; | 103 for (int i = 0; i < quick_unlock::FingerprintStorage::kMaximumUnlockAttempts; |
| 101 ++i) { | 104 ++i) { |
| 102 fingerprint_storage->AddUnlockAttempt(); | 105 fingerprint_storage->AddUnlockAttempt(); |
| 103 } | 106 } |
| 104 EXPECT_FALSE(test_api.IsFingerprintAuthenticationAvailable()); | 107 EXPECT_FALSE(test_api.IsFingerprintAuthenticationAvailable()); |
| 105 fingerprint_storage->ResetUnlockAttemptCount(); | 108 fingerprint_storage->ResetUnlockAttemptCount(); |
| 106 EXPECT_TRUE(test_api.IsFingerprintAuthenticationAvailable()); | 109 EXPECT_TRUE(test_api.IsFingerprintAuthenticationAvailable()); |
| 107 } | 110 } |
| 108 | 111 |
| 109 } // namespace chromeos | 112 } // namespace chromeos |
| OLD | NEW |