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

Unified Diff: components/metrics/persistent_system_profile_unittest.cc

Issue 2938013002: Persist core system profile during startup. (Closed)
Patch Set: added test Created 3 years, 6 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
« no previous file with comments | « components/metrics/persistent_system_profile.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/persistent_system_profile_unittest.cc
diff --git a/components/metrics/persistent_system_profile_unittest.cc b/components/metrics/persistent_system_profile_unittest.cc
index 5ca4e898637f28e3a37e043b7a756afecea06dee..a2e038a47d2ebc5791e69dc9eeff42d2e9cf8ec6 100644
--- a/components/metrics/persistent_system_profile_unittest.cc
+++ b/components/metrics/persistent_system_profile_unittest.cc
@@ -91,7 +91,7 @@ TEST_F(PersistentSystemProfileTest, ProfileStorage) {
trial->set_name_id(123);
trial->set_group_id(456);
- persistent_profile()->SetSystemProfile(proto1);
+ persistent_profile()->SetSystemProfile(proto1, false);
SystemProfileProto proto2;
ASSERT_TRUE(PersistentSystemProfile::HasSystemProfile(*memory_allocator()));
@@ -107,7 +107,23 @@ TEST_F(PersistentSystemProfileTest, ProfileStorage) {
trial->set_name_id(78);
trial->set_group_id(90);
- persistent_profile()->SetSystemProfile(proto1);
+ persistent_profile()->SetSystemProfile(proto1, true);
+
+ ASSERT_TRUE(
+ PersistentSystemProfile::GetSystemProfile(*memory_allocator(), &proto2));
+ ASSERT_EQ(2, proto2.field_trial_size());
+ EXPECT_EQ(123U, proto2.field_trial(0).name_id());
+ EXPECT_EQ(456U, proto2.field_trial(0).group_id());
+ EXPECT_EQ(78U, proto2.field_trial(1).name_id());
+ EXPECT_EQ(90U, proto2.field_trial(1).group_id());
+
+ // Check that the profile won't be overwritten by a new non-complete profile.
+
+ trial = proto1.add_field_trial();
+ trial->set_name_id(0xC0DE);
+ trial->set_group_id(0xFEED);
+
+ persistent_profile()->SetSystemProfile(proto1, false);
ASSERT_TRUE(
PersistentSystemProfile::GetSystemProfile(*memory_allocator(), &proto2));
« no previous file with comments | « components/metrics/persistent_system_profile.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698