| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/quick_unlock_factory.h" | 5 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" |
| 6 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" | 6 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" |
| 7 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" | 7 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" |
| 8 #include "chrome/common/pref_names.h" | 8 #include "chrome/common/pref_names.h" |
| 9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "components/prefs/pref_service.h" | 10 #include "components/prefs/pref_service.h" |
| 11 #include "components/prefs/scoped_user_pref_update.h" | 11 #include "components/prefs/scoped_user_pref_update.h" |
| 12 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 class PinStorageUnitTest : public testing::Test { | 18 class PinStorageUnitTest : public testing::Test { |
| 19 protected: | 19 protected: |
| 20 PinStorageUnitTest() : profile_(new TestingProfile()) {} | 20 PinStorageUnitTest() : profile_(new TestingProfile()) {} |
| 21 ~PinStorageUnitTest() override {} | 21 ~PinStorageUnitTest() override {} |
| 22 | 22 |
| 23 // testing::Test: | 23 // testing::Test: |
| 24 void SetUp() override { quick_unlock::EnableForTesting(); } | 24 void SetUp() override { |
| 25 quick_unlock::EnableForTesting(quick_unlock::PinStorageProvider::Prefs); |
| 26 } |
| 25 | 27 |
| 26 content::TestBrowserThreadBundle thread_bundle_; | 28 content::TestBrowserThreadBundle thread_bundle_; |
| 27 std::unique_ptr<TestingProfile> profile_; | 29 std::unique_ptr<TestingProfile> profile_; |
| 28 | 30 |
| 29 DISALLOW_COPY_AND_ASSIGN(PinStorageUnitTest); | 31 DISALLOW_COPY_AND_ASSIGN(PinStorageUnitTest); |
| 30 }; | 32 }; |
| 31 | 33 |
| 32 } // namespace | 34 } // namespace |
| 33 | 35 |
| 34 // Provides test-only PinStorage APIs. | 36 // Provides test-only PinStorage APIs. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 EXPECT_TRUE(pin_storage_test.IsPinAuthenticationAvailable()); | 133 EXPECT_TRUE(pin_storage_test.IsPinAuthenticationAvailable()); |
| 132 for (int i = 0; i < quick_unlock::PinStorage::kMaximumUnlockAttempts; ++i) | 134 for (int i = 0; i < quick_unlock::PinStorage::kMaximumUnlockAttempts; ++i) |
| 133 EXPECT_FALSE(pin_storage_test.TryAuthenticatePin("foobar")); | 135 EXPECT_FALSE(pin_storage_test.TryAuthenticatePin("foobar")); |
| 134 | 136 |
| 135 // We used up all of the attempts, so entering the right PIN will still fail. | 137 // We used up all of the attempts, so entering the right PIN will still fail. |
| 136 EXPECT_FALSE(pin_storage_test.IsPinAuthenticationAvailable()); | 138 EXPECT_FALSE(pin_storage_test.IsPinAuthenticationAvailable()); |
| 137 EXPECT_FALSE(pin_storage_test.TryAuthenticatePin("1111")); | 139 EXPECT_FALSE(pin_storage_test.TryAuthenticatePin("1111")); |
| 138 } | 140 } |
| 139 | 141 |
| 140 } // namespace chromeos | 142 } // namespace chromeos |
| OLD | NEW |