Chromium Code Reviews| Index: chrome/browser/signin/local_auth_unittest.cc |
| diff --git a/chrome/browser/signin/local_auth_unittest.cc b/chrome/browser/signin/local_auth_unittest.cc |
| index 68ee397043ad9c9614b444ad6611043eda24453d..e0a59b39af9ddac49b71ae85fd299226a4b40367 100644 |
| --- a/chrome/browser/signin/local_auth_unittest.cc |
| +++ b/chrome/browser/signin/local_auth_unittest.cc |
| @@ -56,3 +56,26 @@ TEST(LocalAuthTest, SetAndCheckCredentials) { |
| SetLocalAuthCredentials(prof, password); // makes different salt |
| EXPECT_NE(passhash, cache.GetLocalAuthCredentialsOfProfileAtIndex(0)); |
| } |
| + |
| +TEST(LocalAuthTest, TruncateStringTo16Bits) { |
| + std::string two_chars = "AB"; |
|
jww
2015/01/22 21:48:18
It seems like you might want these tests to actual
Mike Lerman
2015/01/27 21:02:26
TruncateStringTo16Bit was a tricky method to write
|
| + std::string three_chars = "ABC"; |
| + EXPECT_EQ(two_chars, TruncateStringByBits(two_chars, 16)); |
| + EXPECT_EQ(two_chars, TruncateStringByBits(three_chars, 16)); |
| +} |
| + |
| +TEST(LocalAuthTest, TruncateStringTo14BitsLowBitsOnly) { |
| + std::string two_chars = "A6"; |
| + std::string three_chars = "A6C"; |
| + EXPECT_EQ(two_chars, TruncateStringByBits(two_chars, 14)); |
| + EXPECT_EQ(two_chars, TruncateStringByBits(three_chars, 14)); |
| +} |
| + |
| +TEST(LocalAuthTest, TruncateStringTo14BitsLowAndHighBits) { |
| + std::string two_chars = "Az"; |
| + std::string three_chars = "AzC"; |
| + // 'z' = 0x7A, ':' = 0x3A. |
| + std::string two_chars_truncated = "A:"; |
| + EXPECT_EQ(two_chars_truncated, TruncateStringByBits(two_chars, 14)); |
| + EXPECT_EQ(two_chars_truncated, TruncateStringByBits(three_chars, 14)); |
| +} |