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

Unified Diff: components/proximity_auth/proximity_auth_pref_manager_unittest.cc

Issue 2973243002: Adding pref to store the user-selected proximity threshold. (Closed)
Patch Set: Fixing merge issues Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: components/proximity_auth/proximity_auth_pref_manager_unittest.cc
diff --git a/components/proximity_auth/proximity_auth_pref_manager_unittest.cc b/components/proximity_auth/proximity_auth_pref_manager_unittest.cc
index 3ae2072b8356e69d0b2852d4e0cc2e65f4fde585..78856f71a141dbc7567c183f6709c2f246f599fc 100644
--- a/components/proximity_auth/proximity_auth_pref_manager_unittest.cc
+++ b/components/proximity_auth/proximity_auth_pref_manager_unittest.cc
@@ -10,8 +10,8 @@
#include <vector>
#include "base/macros.h"
-#include "components/prefs/testing_pref_service.h"
#include "components/proximity_auth/proximity_auth_pref_names.h"
+#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -27,6 +27,11 @@ const char kPublicKey2[] = "public key 2";
const int64_t kPasswordEntryTimestampMs1 = 123456789L;
const int64_t kPasswordEntryTimestampMs2 = 987654321L;
+const ProximityAuthPrefManager::ProximityThreshold kProximityThreshold1 =
+ ProximityAuthPrefManager::ProximityThreshold::kFar;
+const ProximityAuthPrefManager::ProximityThreshold kProximityThreshold2 =
+ ProximityAuthPrefManager::ProximityThreshold::kVeryFar;
+
} // namespace
class ProximityAuthProximityAuthPrefManagerTest : public testing::Test {
@@ -47,14 +52,14 @@ class ProximityAuthProximityAuthPrefManagerTest : public testing::Test {
EXPECT_EQ(pref_manager.GetDeviceAddress(public_key), bluetooth_address);
}
- TestingPrefServiceSimple pref_service_;
+ sync_preferences::TestingPrefServiceSyncable pref_service_;
private:
DISALLOW_COPY_AND_ASSIGN(ProximityAuthProximityAuthPrefManagerTest);
};
TEST_F(ProximityAuthProximityAuthPrefManagerTest, RegisterPrefs) {
- TestingPrefServiceSimple pref_service;
+ sync_preferences::TestingPrefServiceSyncable pref_service;
ProximityAuthPrefManager::RegisterPrefs(pref_service.registry());
EXPECT_TRUE(
pref_service.FindPreference(prefs::kProximityAuthRemoteBleDevices));
@@ -170,4 +175,13 @@ TEST_F(ProximityAuthProximityAuthPrefManagerTest, LastPasswordEntryTimestamp) {
pref_manager.GetLastPasswordEntryTimestampMs());
}
+TEST_F(ProximityAuthProximityAuthPrefManagerTest, ProximityThreshold) {
+ ProximityAuthPrefManager pref_manager(&pref_service_);
+ EXPECT_EQ(1, pref_manager.GetProximityThreshold());
+ pref_manager.SetProximityThreshold(kProximityThreshold1);
+ EXPECT_EQ(kProximityThreshold1, pref_manager.GetProximityThreshold());
+ pref_manager.SetProximityThreshold(kProximityThreshold2);
+ EXPECT_EQ(kProximityThreshold2, pref_manager.GetProximityThreshold());
+}
+
} // namespace proximity_auth
« no previous file with comments | « components/proximity_auth/proximity_auth_pref_manager.cc ('k') | components/proximity_auth/proximity_auth_pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698