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/pin_storage.h" | 5 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" |
6 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" | 6 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" |
7 | 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 "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 class PinStorageUnitTest : public testing::Test { | 15 class PinStorageUnitTest : public testing::Test { |
16 protected: | 16 protected: |
17 PinStorageUnitTest() : profile_(new TestingProfile()) {} | 17 PinStorageUnitTest() : profile_(new TestingProfile()) {} |
| 18 ~PinStorageUnitTest() override {} |
| 19 |
| 20 // testing::Test: |
| 21 void SetUp() override { chromeos::EnableQuickUnlockForTesting(); } |
18 | 22 |
19 std::unique_ptr<TestingProfile> profile_; | 23 std::unique_ptr<TestingProfile> profile_; |
20 | 24 |
21 DISALLOW_COPY_AND_ASSIGN(PinStorageUnitTest); | 25 DISALLOW_COPY_AND_ASSIGN(PinStorageUnitTest); |
22 }; | 26 }; |
23 | 27 |
24 } // namespace | 28 } // namespace |
25 | 29 |
26 // Provides test-only PinStorage APIs. | 30 // Provides test-only PinStorage APIs. |
27 class PinStorageTestApi { | 31 class PinStorageTestApi { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 pin_storage->SetPin("1111"); | 156 pin_storage->SetPin("1111"); |
153 pin_storage->MarkStrongAuth(); | 157 pin_storage->MarkStrongAuth(); |
154 EXPECT_TRUE(pin_storage->IsPinAuthenticationAvailable()); | 158 EXPECT_TRUE(pin_storage->IsPinAuthenticationAvailable()); |
155 | 159 |
156 // Remove all of the strong auth time so that we have a strong auth timeout. | 160 // Remove all of the strong auth time so that we have a strong auth timeout. |
157 pin_storage_test.ReduceRemainingStrongAuthTimeBy( | 161 pin_storage_test.ReduceRemainingStrongAuthTimeBy( |
158 chromeos::PinStorage::kStrongAuthTimeout + base::TimeDelta::FromHours(1)); | 162 chromeos::PinStorage::kStrongAuthTimeout + base::TimeDelta::FromHours(1)); |
159 | 163 |
160 EXPECT_FALSE(pin_storage->IsPinAuthenticationAvailable()); | 164 EXPECT_FALSE(pin_storage->IsPinAuthenticationAvailable()); |
161 } | 165 } |
OLD | NEW |