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

Unified Diff: chrome/browser/metrics/metrics_service_browsertest.cc

Issue 10830241: Inform GetEntropySource of whether or not metrics reporting will be enabled. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: thakis nit Created 8 years, 4 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 | « chrome/browser/metrics/metrics_service.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
+}
« no previous file with comments | « chrome/browser/metrics/metrics_service.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698