Index: components/variations/variations_seed_store_unittest.cc |
diff --git a/components/variations/variations_seed_store_unittest.cc b/components/variations/variations_seed_store_unittest.cc |
index 5821475bc0ba9ca752eb1a9d0968da5175793cf6..7f12e3458a16e3d880fb670bbbee9b7f4bf1ea1c 100644 |
--- a/components/variations/variations_seed_store_unittest.cc |
+++ b/components/variations/variations_seed_store_unittest.cc |
@@ -24,7 +24,7 @@ class TestVariationsSeedStore : public VariationsSeedStore { |
bool StoreSeedForTesting(const std::string& seed_data) { |
return StoreSeedData(seed_data, std::string(), std::string(), |
- base::Time::Now(), false, nullptr); |
+ base::Time::Now(), false, false, nullptr); |
} |
VariationsSeedStore::VerifySignatureResult VerifySeedSignature( |
@@ -211,7 +211,7 @@ TEST(VariationsSeedStoreTest, StoreSeedData_ParsedSeed) { |
variations::VariationsSeed parsed_seed; |
EXPECT_TRUE(seed_store.StoreSeedData(serialized_seed, std::string(), |
std::string(), base::Time::Now(), false, |
- &parsed_seed)); |
+ false, &parsed_seed)); |
EXPECT_EQ(serialized_seed, SerializeSeed(parsed_seed)); |
} |
@@ -225,7 +225,7 @@ TEST(VariationsSeedStoreTest, StoreSeedData_CountryCode) { |
seed.set_country_code("test_country"); |
EXPECT_TRUE(seed_store.StoreSeedData(SerializeSeed(seed), std::string(), |
std::string(), base::Time::Now(), false, |
- nullptr)); |
+ false, nullptr)); |
EXPECT_EQ("test_country", prefs.GetString(prefs::kVariationsCountry)); |
// Test with a header value and no seed country. |
@@ -233,7 +233,7 @@ TEST(VariationsSeedStoreTest, StoreSeedData_CountryCode) { |
seed.clear_country_code(); |
EXPECT_TRUE(seed_store.StoreSeedData(SerializeSeed(seed), std::string(), |
"test_country2", base::Time::Now(), |
- false, nullptr)); |
+ false, false, nullptr)); |
EXPECT_EQ("test_country2", prefs.GetString(prefs::kVariationsCountry)); |
// Test with a seed country code and header value. |
@@ -241,17 +241,34 @@ TEST(VariationsSeedStoreTest, StoreSeedData_CountryCode) { |
seed.set_country_code("test_country3"); |
EXPECT_TRUE(seed_store.StoreSeedData(SerializeSeed(seed), std::string(), |
"test_country4", base::Time::Now(), |
- false, nullptr)); |
+ false, false, nullptr)); |
EXPECT_EQ("test_country4", prefs.GetString(prefs::kVariationsCountry)); |
// Test with no country code specified - which should preserve the old value. |
seed.clear_country_code(); |
EXPECT_TRUE(seed_store.StoreSeedData(SerializeSeed(seed), std::string(), |
std::string(), base::Time::Now(), false, |
- nullptr)); |
+ false, nullptr)); |
EXPECT_EQ("test_country4", prefs.GetString(prefs::kVariationsCountry)); |
} |
+TEST(VariationsSeedStoreTest, StoreSeedData_GzippedSeed) { |
+ const variations::VariationsSeed seed = CreateTestSeed(); |
+ const std::string serialized_seed = SerializeSeed(seed); |
+ std::string compressed_seed; |
+ ASSERT_TRUE(compression::GzipCompress(serialized_seed, &compressed_seed)); |
+ |
+ TestingPrefServiceSimple prefs; |
+ VariationsSeedStore::RegisterPrefs(prefs.registry()); |
+ TestVariationsSeedStore seed_store(&prefs); |
+ |
+ variations::VariationsSeed parsed_seed; |
+ EXPECT_TRUE(seed_store.StoreSeedData(compressed_seed, std::string(), |
+ std::string(), base::Time::Now(), false, |
+ true, &parsed_seed)); |
+ EXPECT_EQ(serialized_seed, SerializeSeed(parsed_seed)); |
+} |
+ |
TEST(VariationsSeedStoreTest, VerifySeedSignature) { |
// The below seed and signature pair were generated using the server's |
// private key. |