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

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: Added browsertest 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
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..715471fbe22a1a6be1d6014482a62e94d4d4c517 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::kEnableMetricsReporting);
Ilya Sherman 2012/08/09 20:41:18 Before committing this, can you verify that we're
SteveT 2012/08/09 21:07:59 Sure, I can take a look at that. I thought that th
+ }
+};
+
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());
+}

Powered by Google App Engine
This is Rietveld 408576698