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

Unified Diff: chrome/browser/metrics/variations/variations_seed_store_unittest.cc

Issue 412943002: Move variations component code to variations namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 5 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
Index: chrome/browser/metrics/variations/variations_seed_store_unittest.cc
===================================================================
--- chrome/browser/metrics/variations/variations_seed_store_unittest.cc (revision 285608)
+++ 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.
-VariationsSeed CreateTestSeed() {
- VariationsSeed seed;
- Study* study = seed.add_study();
+variations::VariationsSeed CreateTestSeed() {
+ variations::VariationsSeed seed;
+ variations::Study* study = seed.add_study();
study->set_name("test");
study->set_default_experiment_name("abc");
- Study_Experiment* experiment = study->add_experiment();
+ variations::Study_Experiment* experiment = study->add_experiment();
experiment->set_name("abc");
experiment->set_probability_weight(100);
seed.set_serial_number("123");
@@ -56,14 +56,15 @@
}
// Serializes |seed| to protobuf binary format.
-std::string SerializeSeed(const VariationsSeed& seed) {
+std::string SerializeSeed(const variations::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 VariationsSeed& seed, std::string* hash) {
+std::string SerializeSeedBase64(const variations::VariationsSeed& seed,
+ std::string* hash) {
std::string serialized_seed = SerializeSeed(seed);
if (hash != NULL) {
std::string sha1 = base::SHA1HashString(serialized_seed);
@@ -85,7 +86,7 @@
TEST(VariationsSeedStoreTest, LoadSeed) {
// Store good seed data to test if loading from prefs works.
- const VariationsSeed seed = CreateTestSeed();
+ const variations::VariationsSeed seed = CreateTestSeed();
std::string seed_hash;
const std::string base64_seed = SerializeSeedBase64(seed, &seed_hash);
@@ -95,7 +96,7 @@
TestVariationsSeedStore seed_store(&prefs);
- VariationsSeed loaded_seed;
+ variations::VariationsSeed loaded_seed;
// Check that loading a seed without a hash pref set works correctly.
EXPECT_TRUE(seed_store.LoadSeed(&loaded_seed));
@@ -126,7 +127,7 @@
}
TEST(VariationsSeedStoreTest, StoreSeedData) {
- const VariationsSeed seed = CreateTestSeed();
+ const variations::VariationsSeed seed = CreateTestSeed();
const std::string serialized_seed = SerializeSeed(seed);
TestingPrefServiceSimple prefs;
@@ -152,14 +153,14 @@
}
TEST(VariationsSeedStoreTest, StoreSeedData_ParsedSeed) {
- const VariationsSeed seed = CreateTestSeed();
+ const variations::VariationsSeed seed = CreateTestSeed();
const std::string serialized_seed = SerializeSeed(seed);
TestingPrefServiceSimple prefs;
VariationsSeedStore::RegisterPrefs(prefs.registry());
TestVariationsSeedStore seed_store(&prefs);
- VariationsSeed parsed_seed;
+ variations::VariationsSeed parsed_seed;
EXPECT_TRUE(seed_store.StoreSeedData(serialized_seed, std::string(),
base::Time::Now(), &parsed_seed));
EXPECT_EQ(serialized_seed, SerializeSeed(parsed_seed));
« no previous file with comments | « chrome/browser/metrics/variations/variations_seed_store.cc ('k') | chrome/browser/metrics/variations/variations_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698