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

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

Issue 268223002: Revert 268232 "Refactor MetricsStateManager class out of Metrics..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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: 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());
+}
« no previous file with comments | « trunk/src/chrome/browser/metrics/metrics_service.cc ('k') | trunk/src/chrome/browser/metrics/metrics_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698