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