Index: trunk/src/chrome/browser/metrics/metrics_service_browsertest.cc |
=================================================================== |
--- trunk/src/chrome/browser/metrics/metrics_service_browsertest.cc (revision 268245) |
+++ trunk/src/chrome/browser/metrics/metrics_service_browsertest.cc (working copy) |
@@ -5,8 +5,6 @@ |
// Tests the MetricsService stat recording to make sure that the numbers are |
// what we expect. |
-#include "chrome/browser/metrics/metrics_service.h" |
- |
#include <string> |
#include "base/command_line.h" |
@@ -14,6 +12,7 @@ |
#include "base/path_service.h" |
#include "base/prefs/pref_service.h" |
#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/metrics/metrics_service.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
#include "chrome/common/chrome_paths.h" |
@@ -59,6 +58,14 @@ |
} |
}; |
+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(MetricsServiceBrowserTest, CloseRenderersNormally) { |
OpenTabs(); |
@@ -108,3 +115,20 @@ |
// exits... it's not clear to me how to test that. |
} |
+IN_PROC_BROWSER_TEST_F(MetricsServiceBrowserTest, 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()); |
+} |