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

Unified Diff: components/variations/study_filtering.cc

Issue 2970093002: Add variations filtering for is_low_end_device. (Closed)
Patch Set: Address comments. Created 3 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
« no previous file with comments | « components/variations/study_filtering.h ('k') | components/variations/study_filtering_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/variations/study_filtering.cc
diff --git a/components/variations/study_filtering.cc b/components/variations/study_filtering.cc
index e7ccd25888f272b6ad9d4946c33943e3b2c243ff..97d43905d8b8649549f78c0af04a394755359823 100644
--- a/components/variations/study_filtering.cc
+++ b/components/variations/study_filtering.cc
@@ -116,6 +116,12 @@ bool CheckStudyPlatform(const Study::Filter& filter, Study::Platform platform) {
return false;
}
+bool CheckStudyLowEndDevice(const Study::Filter& filter,
+ bool is_low_end_device) {
+ return !filter.has_is_low_end_device() ||
+ filter.is_low_end_device() == is_low_end_device;
+}
+
bool CheckStudyStartDate(const Study::Filter& filter,
const base::Time& date_time) {
if (filter.has_start_date()) {
@@ -245,6 +251,13 @@ bool ShouldAddStudy(const Study& study,
return false;
}
+ if (!CheckStudyLowEndDevice(study.filter(),
+ client_state.is_low_end_device)) {
+ DVLOG(1) << "Filtered out study " << study.name()
+ << " due to is_low_end_device.";
+ return false;
+ }
+
const std::string& country = GetClientCountryForStudy(study, client_state);
if (!CheckStudyCountry(study.filter(), country)) {
DVLOG(1) << "Filtered out study " << study.name() << " due to country.";
« no previous file with comments | « components/variations/study_filtering.h ('k') | components/variations/study_filtering_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698