Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage_unittest.cc

Issue 2815733003: cros: Add PinStorageProvider enum which describes pin backend in use. (Closed)
Patch Set: Address comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/quick_unlock_storage.h" 5 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h"
6 6
7 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" 7 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h"
8 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" 8 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h"
9 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 base::TimeDelta GetExpirationTime(PrefService* pref_service) { 25 base::TimeDelta GetExpirationTime(PrefService* pref_service) {
26 int frequency = pref_service->GetInteger(prefs::kQuickUnlockTimeout); 26 int frequency = pref_service->GetInteger(prefs::kQuickUnlockTimeout);
27 return quick_unlock::PasswordConfirmationFrequencyToTimeDelta( 27 return quick_unlock::PasswordConfirmationFrequencyToTimeDelta(
28 static_cast<quick_unlock::PasswordConfirmationFrequency>(frequency)); 28 static_cast<quick_unlock::PasswordConfirmationFrequency>(frequency));
29 } 29 }
30 30
31 class QuickUnlockStorageUnitTest : public testing::Test { 31 class QuickUnlockStorageUnitTest : public testing::Test {
32 protected: 32 protected:
33 QuickUnlockStorageUnitTest() : profile_(new TestingProfile()) {} 33 QuickUnlockStorageUnitTest() : profile_(base::MakeUnique<TestingProfile>()) {}
34 ~QuickUnlockStorageUnitTest() override {} 34 ~QuickUnlockStorageUnitTest() override {}
35 35
36 // testing::Test: 36 // testing::Test:
37 void SetUp() override { quick_unlock::EnableForTesting(); } 37 void SetUp() override {
38 quick_unlock::EnableForTesting(quick_unlock::PinStorageType::kPrefs);
39 }
38 40
39 content::TestBrowserThreadBundle thread_bundle_; 41 content::TestBrowserThreadBundle thread_bundle_;
40 std::unique_ptr<TestingProfile> profile_; 42 std::unique_ptr<TestingProfile> profile_;
41 43
42 DISALLOW_COPY_AND_ASSIGN(QuickUnlockStorageUnitTest); 44 DISALLOW_COPY_AND_ASSIGN(QuickUnlockStorageUnitTest);
43 }; 45 };
44 46
45 } // namespace 47 } // namespace
46 48
47 // Provides test-only QuickUnlockStorage APIs. 49 // Provides test-only QuickUnlockStorage APIs.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 expiration_time = GetExpirationTime(pref_service); 145 expiration_time = GetExpirationTime(pref_service);
144 EXPECT_TRUE(quick_unlock_storage->HasStrongAuth()); 146 EXPECT_TRUE(quick_unlock_storage->HasStrongAuth());
145 test_api.ReduceRemainingStrongAuthTimeBy(expiration_time); 147 test_api.ReduceRemainingStrongAuthTimeBy(expiration_time);
146 EXPECT_FALSE(quick_unlock_storage->HasStrongAuth()); 148 EXPECT_FALSE(quick_unlock_storage->HasStrongAuth());
147 SetConfirmationFrequency( 149 SetConfirmationFrequency(
148 pref_service, quick_unlock::PasswordConfirmationFrequency::TWELVE_HOURS); 150 pref_service, quick_unlock::PasswordConfirmationFrequency::TWELVE_HOURS);
149 EXPECT_TRUE(quick_unlock_storage->HasStrongAuth()); 151 EXPECT_TRUE(quick_unlock_storage->HasStrongAuth());
150 } 152 }
151 153
152 } // namespace chromeos 154 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698