Index: chrome/browser/metrics/variations_service.h |
diff --git a/chrome/browser/metrics/variations_service.h b/chrome/browser/metrics/variations_service.h |
index be9323d1d8a92f7c7933dc5d67206c48092e7944..d3ff997ebcef82bd192c7cbcee05cfc75724ca90 100644 |
--- a/chrome/browser/metrics/variations_service.h |
+++ b/chrome/browser/metrics/variations_service.h |
@@ -6,9 +6,15 @@ |
#define CHROME_BROWSER_METRICS_VARIATIONS_SERVICE_H_ |
#pragma once |
+#include <string> |
+ |
#include "base/compiler_specific.h" |
+#include "base/gtest_prod_util.h" |
+#include "base/time.h" |
#include "base/memory/scoped_ptr.h" |
+#include "chrome/browser/metrics/proto/study.pb.h" |
#include "chrome/browser/metrics/proto/trials_seed.pb.h" |
+#include "chrome/common/chrome_version_info.h" |
#include "content/public/common/url_fetcher_delegate.h" |
template <typename T> struct DefaultSingletonTraits; |
@@ -40,6 +46,11 @@ class VariationsService : public content::URLFetcherDelegate { |
private: |
friend struct DefaultSingletonTraits<VariationsService>; |
+ FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyChannel); |
+ FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyVersion); |
+ FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyVersionWildcards); |
+ FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyDate); |
+ |
VariationsService(); |
// Store the given seed data to the given local prefs. Note that |seed_data| |
@@ -48,6 +59,22 @@ class VariationsService : public content::URLFetcherDelegate { |
// fails, the |local_prefs| is left as is. |
void StoreSeedData(const std::string& seed_data, PrefService* local_prefs); |
+ // Returns whether |study| should be added to the local field trials list |
+ // according to its restriction parameters. |
+ static bool ShouldAddStudy(const chrome_variations::Study& study); |
+ |
+ // Checks whether |study| is applicable for the given |channel|. |
+ static bool CheckStudyChannel(const chrome_variations::Study& study, |
+ chrome::VersionInfo::Channel channel); |
+ |
+ // Checks whether |study| is applicable for the given version string. |
+ static bool CheckStudyVersion(const chrome_variations::Study& study, |
+ const std::string& version_string); |
+ |
+ // Checks whether |study| is applicable for the given date/time. |
+ static bool CheckStudyDate(const chrome_variations::Study& study, |
+ const base::Time& date_time); |
+ |
// Contains the current seed request. Will only have a value while a request |
// is pending, and will be reset by |OnURLFetchComplete|. |
scoped_ptr<content::URLFetcher> pending_seed_request_; |