| Index: trunk/src/chrome/browser/metrics/variations/variations_seed_store_unittest.cc
|
| ===================================================================
|
| --- trunk/src/chrome/browser/metrics/variations/variations_seed_store_unittest.cc (revision 285674)
|
| +++ trunk/src/chrome/browser/metrics/variations/variations_seed_store_unittest.cc (working copy)
|
| @@ -43,12 +43,12 @@
|
| // study called "test", which contains one experiment called "abc" with
|
| // probability weight 100. |seed|'s study field will be cleared before adding
|
| // the new study.
|
| -variations::VariationsSeed CreateTestSeed() {
|
| - variations::VariationsSeed seed;
|
| - variations::Study* study = seed.add_study();
|
| +VariationsSeed CreateTestSeed() {
|
| + VariationsSeed seed;
|
| + Study* study = seed.add_study();
|
| study->set_name("test");
|
| study->set_default_experiment_name("abc");
|
| - variations::Study_Experiment* experiment = study->add_experiment();
|
| + Study_Experiment* experiment = study->add_experiment();
|
| experiment->set_name("abc");
|
| experiment->set_probability_weight(100);
|
| seed.set_serial_number("123");
|
| @@ -56,15 +56,14 @@
|
| }
|
|
|
| // Serializes |seed| to protobuf binary format.
|
| -std::string SerializeSeed(const variations::VariationsSeed& seed) {
|
| +std::string SerializeSeed(const VariationsSeed& seed) {
|
| std::string serialized_seed;
|
| seed.SerializeToString(&serialized_seed);
|
| return serialized_seed;
|
| }
|
|
|
| // Serializes |seed| to base64-encoded protobuf binary format.
|
| -std::string SerializeSeedBase64(const variations::VariationsSeed& seed,
|
| - std::string* hash) {
|
| +std::string SerializeSeedBase64(const VariationsSeed& seed, std::string* hash) {
|
| std::string serialized_seed = SerializeSeed(seed);
|
| if (hash != NULL) {
|
| std::string sha1 = base::SHA1HashString(serialized_seed);
|
| @@ -86,7 +85,7 @@
|
|
|
| TEST(VariationsSeedStoreTest, LoadSeed) {
|
| // Store good seed data to test if loading from prefs works.
|
| - const variations::VariationsSeed seed = CreateTestSeed();
|
| + const VariationsSeed seed = CreateTestSeed();
|
| std::string seed_hash;
|
| const std::string base64_seed = SerializeSeedBase64(seed, &seed_hash);
|
|
|
| @@ -96,7 +95,7 @@
|
|
|
| TestVariationsSeedStore seed_store(&prefs);
|
|
|
| - variations::VariationsSeed loaded_seed;
|
| + VariationsSeed loaded_seed;
|
| // Check that loading a seed without a hash pref set works correctly.
|
| EXPECT_TRUE(seed_store.LoadSeed(&loaded_seed));
|
|
|
| @@ -127,7 +126,7 @@
|
| }
|
|
|
| TEST(VariationsSeedStoreTest, StoreSeedData) {
|
| - const variations::VariationsSeed seed = CreateTestSeed();
|
| + const VariationsSeed seed = CreateTestSeed();
|
| const std::string serialized_seed = SerializeSeed(seed);
|
|
|
| TestingPrefServiceSimple prefs;
|
| @@ -153,14 +152,14 @@
|
| }
|
|
|
| TEST(VariationsSeedStoreTest, StoreSeedData_ParsedSeed) {
|
| - const variations::VariationsSeed seed = CreateTestSeed();
|
| + const VariationsSeed seed = CreateTestSeed();
|
| const std::string serialized_seed = SerializeSeed(seed);
|
|
|
| TestingPrefServiceSimple prefs;
|
| VariationsSeedStore::RegisterPrefs(prefs.registry());
|
| TestVariationsSeedStore seed_store(&prefs);
|
|
|
| - variations::VariationsSeed parsed_seed;
|
| + VariationsSeed parsed_seed;
|
| EXPECT_TRUE(seed_store.StoreSeedData(serialized_seed, std::string(),
|
| base::Time::Now(), &parsed_seed));
|
| EXPECT_EQ(serialized_seed, SerializeSeed(parsed_seed));
|
|
|