Index: chrome/browser/metrics/metrics_service.h |
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h |
index 90e0ea5ec2cce2de4f8a59fe04821a906c1351da..9438907ea4f50daec992474e8a328236a5cf87d8 100644 |
--- a/chrome/browser/metrics/metrics_service.h |
+++ b/chrome/browser/metrics/metrics_service.h |
@@ -71,6 +71,15 @@ class MetricsService |
public net::URLFetcherDelegate, |
public MetricsServiceBase { |
public: |
+ // Designates which entropy source was returned from this MetricsService. |
+ // This is used for testing to validate that we return the correct source |
+ // depending on the state of the service. |
+ enum EntropySourceReturned { |
+ LAST_ENTROPY_NONE, |
+ LAST_ENTROPY_LOW, |
+ LAST_ENTROPY_HIGH, |
+ }; |
Ilya Sherman
2012/08/09 20:41:18
nit: Can we make this (and the corresponding gette
SteveT
2012/08/09 21:07:59
Sure can! Done.
|
+ |
MetricsService(); |
virtual ~MetricsService(); |
@@ -87,10 +96,22 @@ class MetricsService |
std::string GetClientId(); |
// Returns the preferred entropy source used to seed persistent activities |
- // based on whether or not metrics reporting is permitted on this client. If |
- // it is permitted, this returns the client ID concatenated with the low |
- // entropy source. Otherwise, this just returns the low entropy source. |
- std::string GetEntropySource(); |
+ // based on whether or not metrics reporting will permitted on this client. |
+ // The caller must determine if metrics reporting will be enabled for this |
+ // client and pass that state in as |reporting_will_be_enabled|. If |
+ // |reporting_will_be_enabled| is true, this method returns the client ID |
+ // concatenated with the low entropy source. Otherwise, this method just |
+ // returns the low entropy source. Note that this reporting state can not be |
+ // checked by reporting_active() because this method may need to be called |
+ // before the MetricsService needs to be started. |
+ std::string GetEntropySource(bool reporting_will_be_enabled); |
+ |
+ // Returns the last entropy source that was returned by this service since |
+ // start up, or NONE if neither was returned yet. This is exposed for testing |
+ // only. |
+ EntropySourceReturned entropy_source_returned() const { |
+ return entropy_source_returned_; |
+ } |
// Force the client ID to be generated. This is useful in case it's needed |
// before recording. |
@@ -462,6 +483,9 @@ class MetricsService |
scoped_refptr<chromeos::ExternalMetrics> external_metrics_; |
#endif |
+ // The last entropy source returned by this service, used for testing. |
+ EntropySourceReturned entropy_source_returned_; |
+ |
// Reduntant marker to check that we completed our shutdown, and set the |
// exited-cleanly bit in the prefs. |
static ShutdownCleanliness clean_shutdown_status_; |