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

Unified Diff: base/metrics/field_trial_unittest.cc

Issue 695523002: Change dont_embed_build_metadata default to 1 except for Official build and fix some unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the logic in ssl_error_classification.cc Created 6 years, 2 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 | « base/build_time.cc ('k') | build/common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/field_trial_unittest.cc
diff --git a/base/metrics/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc
index 80c729d86a2b36f74737518ec69238fc2a294bbb..1ed3f896d0858224efacf9c820858c646f64130d 100644
--- a/base/metrics/field_trial_unittest.cc
+++ b/base/metrics/field_trial_unittest.cc
@@ -4,6 +4,7 @@
#include "base/metrics/field_trial.h"
+#include "base/build_time.h"
#include "base/message_loop/message_loop.h"
#include "base/rand_util.h"
#include "base/run_loop.h"
@@ -30,10 +31,10 @@ scoped_refptr<base::FieldTrial> CreateFieldTrial(
base::FieldTrial::SESSION_RANDOMIZED, default_group_number);
}
-int GetLastYear() {
- Time last_year_time = Time::NowFromSystemTime() - TimeDelta::FromDays(365);
+int OneYearBeforeBuildTime() {
+ Time one_year_before_build_time = GetBuildTime() - TimeDelta::FromDays(365);
Time::Exploded exploded;
- last_year_time.LocalExplode(&exploded);
+ one_year_before_build_time.LocalExplode(&exploded);
return exploded.year;
}
@@ -249,7 +250,7 @@ TEST_F(FieldTrialTest, DisableProbability) {
// Create a field trail that has expired.
int default_group_number = -1;
FieldTrial* trial = FieldTrialList::FactoryGetFieldTrial(
- name, 1000000000, default_group_name, GetLastYear(), 1, 1,
+ name, 1000000000, default_group_name, OneYearBeforeBuildTime(), 1, 1,
FieldTrial::SESSION_RANDOMIZED,
&default_group_number);
trial->AppendGroup(loser, 999999999); // 99.9999999% chance of being chosen.
« no previous file with comments | « base/build_time.cc ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698