Chromium Code Reviews| Index: chrome/browser/prefs/pref_hash_calculator_unittest.cc |
| diff --git a/chrome/browser/prefs/pref_hash_calculator_unittest.cc b/chrome/browser/prefs/pref_hash_calculator_unittest.cc |
| index 1f5ad7ca660a3438d31540592c6e7ac9d5f7953d..96b950585f3ad5c55aa93bdc1606d406ef121081 100644 |
| --- a/chrome/browser/prefs/pref_hash_calculator_unittest.cc |
| +++ b/chrome/browser/prefs/pref_hash_calculator_unittest.cc |
| @@ -9,6 +9,10 @@ |
| #include "base/values.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| +namespace { |
| +const char kSeed[] = "0123456789ABCDEF0123456789ABCDEF"; |
|
Bernhard Bauer
2014/01/07 19:20:45
The lone namespace here is unnecessary; const vari
|
| +} // namespace |
| + |
| TEST(PrefHashCalculatorTest, TestCurrentAlgorithm) { |
| base::StringValue string_value_1("string value 1"); |
| base::StringValue string_value_2("string value 2"); |
| @@ -74,22 +78,20 @@ TEST(PrefHashCalculatorTest, CatchHashChanges) { |
| const char* kDeviceId = "test_device_id1"; |
| { |
| static const char kExpectedValue[] = |
| - "5CE37D7EBCBC9BE510F0F5E7C326CA92C1673713C3717839610AEA1A217D8BB8"; |
| + "D8137B8E767D3D910DCD3821CAC61D26ABB042E6EC406AEB0E347ED73A3A4EC1"; |
| base::ListValue list; |
| list.Set(0, new base::FundamentalValue(true)); |
| list.Set(1, new base::FundamentalValue(100)); |
| list.Set(2, new base::FundamentalValue(1.0)); |
| - // 32 NULL bytes is the seed that was used to generate the hash in old |
| - // tests. Use it again to ensure that we haven't altered the algorithm. |
| EXPECT_EQ(PrefHashCalculator::VALID, |
| - PrefHashCalculator(std::string(32u, 0), kDeviceId).Validate( |
| + PrefHashCalculator(kSeed, kDeviceId).Validate( |
| "pref.path2", &list, kExpectedValue)); |
| } |
| { |
| static const char kExpectedValue[] = |
| - "A50FE7EB31BFBC32B8A27E71730AF15421178A9B5815644ACE174B18966735B9"; |
| + "3F947A044DE9E421A735525385B4C789693682E6F6E3E4CB4741E58724B28F96"; |
| DictionaryValue dict; |
| dict.Set("a", new StringValue("foo")); |
| @@ -97,10 +99,8 @@ TEST(PrefHashCalculatorTest, CatchHashChanges) { |
| dict.Set("b", new StringValue("bar")); |
| dict.Set("c", new StringValue("baz")); |
| - // 32 NULL bytes is the seed that was used to generate the hash in old |
| - // tests. Use it again to ensure that we haven't altered the algorithm. |
| EXPECT_EQ(PrefHashCalculator::VALID, |
| - PrefHashCalculator(std::string(32u, 0), kDeviceId).Validate( |
| + PrefHashCalculator(kSeed, kDeviceId).Validate( |
| "pref.path1", &dict, kExpectedValue)); |
| } |
| } |
| @@ -108,7 +108,7 @@ TEST(PrefHashCalculatorTest, CatchHashChanges) { |
| TEST(PrefHashCalculatorTest, TestLegacyAlgorithm) { |
| const char* kExpectedValue = |
| "C503FB7C65EEFD5C07185F616A0AA67923C069909933F362022B1F187E73E9A2"; |
| - const char* kDeviceId = "deviceid"; |
| + const char* kDeviceId = "not_used"; |
| DictionaryValue dict; |
| dict.Set("a", new StringValue("foo")); |
| @@ -120,5 +120,4 @@ TEST(PrefHashCalculatorTest, TestLegacyAlgorithm) { |
| EXPECT_EQ(PrefHashCalculator::VALID_LEGACY, |
| PrefHashCalculator(std::string(32u, 0), kDeviceId).Validate( |
| "pref.path1", &dict, kExpectedValue)); |
| - |
| } |