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

Unified Diff: base/ios/device_util_unittest.mm

Issue 309963003: Refactors GetDeviceIdentifier() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/ios/device_util.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/ios/device_util_unittest.mm
diff --git a/base/ios/device_util_unittest.mm b/base/ios/device_util_unittest.mm
index a0c9ec49fc221ae6bafbf585e53c2aa4e2080714..688acc10eabcc66734449ebbd4a8e5b1ab0edffc 100644
--- a/base/ios/device_util_unittest.mm
+++ b/base/ios/device_util_unittest.mm
@@ -99,6 +99,33 @@ TEST_F(DeviceUtilTest, CheckMigrationFromZero) {
CleanNSUserDefaultsForDeviceId();
}
+TEST_F(DeviceUtilTest, GetSaltedStringEquals) {
+ std::string string1("The quick brown fox jumps over the lazy dog");
+ std::string string2("The quick brown fox jumps over the lazy dog");
+ std::string salt("salt");
+ // Same string and same salt should result in the same salted string.
+ EXPECT_EQ(ios::device_util::GetSaltedString(string1, salt),
+ ios::device_util::GetSaltedString(string2, salt));
+}
+
+TEST_F(DeviceUtilTest, GetSaltedStringNotEquals) {
+ std::string string1("The quick brown fox jumps over the lazy dog");
+ std::string string2("The lazy brown fox jumps over the quick dog");
+ std::string salt("salt");
+ // Different string and same salt should result in different salted strings.
+ EXPECT_NE(ios::device_util::GetSaltedString(string1, salt),
+ ios::device_util::GetSaltedString(string2, salt));
+}
+
+TEST_F(DeviceUtilTest, GetSaltedStringDifferentSalt) {
+ std::string string1("The quick brown fox jumps over the lazy dog");
+ std::string salt1("salt");
+ std::string salt2("pepper");
+ // Same string with different salt should result in different salted strings.
+ EXPECT_NE(ios::device_util::GetSaltedString(string1, salt1),
+ ios::device_util::GetSaltedString(string1, salt2));
+}
+
TEST_F(DeviceUtilTest, CheckDeviceMigration) {
CleanNSUserDefaultsForDeviceId();
« no previous file with comments | « base/ios/device_util.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698