Index: chrome/browser/metrics/metrics_service_browsertest.cc |
diff --git a/chrome/browser/metrics/metrics_service_browsertest.cc b/chrome/browser/metrics/metrics_service_browsertest.cc |
index d6fb86e376433118a309286966985e8f43270cd5..be221ae68efcbeb1b45978af45980b355d872ea8 100644 |
--- a/chrome/browser/metrics/metrics_service_browsertest.cc |
+++ b/chrome/browser/metrics/metrics_service_browsertest.cc |
@@ -11,6 +11,7 @@ |
#include "base/file_path.h" |
#include "base/path_service.h" |
#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/metrics/metrics_service.h" |
#include "chrome/browser/prefs/pref_service.h" |
#include "chrome/common/chrome_paths.h" |
#include "chrome/common/chrome_switches.h" |
@@ -56,6 +57,14 @@ class MetricsServiceTest : public InProcessBrowserTest { |
} |
}; |
+class MetricsServiceReportingTest : public InProcessBrowserTest { |
+ public: |
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
+ // Enable the metrics service for testing (in the full mode). |
+ command_line->AppendSwitch(switches::kEnableMetricsReportingForTesting); |
+ } |
+}; |
+ |
IN_PROC_BROWSER_TEST_F(MetricsServiceTest, CloseRenderersNormally) { |
OpenTabs(); |
@@ -104,3 +113,21 @@ IN_PROC_BROWSER_TEST_F(MetricsServiceTest, MAYBE_CrashRenderers) { |
// is set to true, but this preference isn't set until the browser |
// exits... it's not clear to me how to test that. |
} |
+ |
+IN_PROC_BROWSER_TEST_F(MetricsServiceTest, CheckLowEntropySourceUsed) { |
+ // Since MetricsService is only in recording mode, and is not reporting, |
+ // check that the low entropy source is returned at some point. |
+ ASSERT_TRUE(g_browser_process->metrics_service()); |
+ EXPECT_EQ(MetricsService::LAST_ENTROPY_LOW, |
+ g_browser_process->metrics_service()->entropy_source_returned()); |
+} |
+ |
+IN_PROC_BROWSER_TEST_F(MetricsServiceReportingTest, |
+ CheckHighEntropySourceUsed) { |
+ // Since the full metrics service runs in this test, we expect that |
+ // MetricsService returns the full entropy source at some point during |
+ // BrowserMain startup. |
+ ASSERT_TRUE(g_browser_process->metrics_service()); |
+ EXPECT_EQ(MetricsService::LAST_ENTROPY_HIGH, |
+ g_browser_process->metrics_service()->entropy_source_returned()); |
+} |