Index: chrome/browser/metrics/startup_metrics_browsertest.cc |
diff --git a/chrome/browser/metrics/startup_metrics_browsertest.cc b/chrome/browser/metrics/startup_metrics_browsertest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c60e5c9e85ec23c172dfc60f646f61f7e1429aba |
--- /dev/null |
+++ b/chrome/browser/metrics/startup_metrics_browsertest.cc |
@@ -0,0 +1,53 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include <set> |
+ |
+#include "base/metrics/histogram_samples.h" |
+#include "base/metrics/statistics_recorder.h" |
+#include "base/run_loop.h" |
+#include "chrome/test/base/in_process_browser_test.h" |
+ |
+using StartupMetricsTest = InProcessBrowserTest; |
+ |
+namespace { |
+ |
+constexpr const char* kStartupMetrics[] = { |
+ "Startup.BrowserMainToRendererMain", |
+ "Startup.BrowserOpenTabs", |
+ "Startup.BrowserWindow.FirstPaint", |
+ "Startup.BrowserWindow.FirstPaint.CompositingEnded", |
+ "Startup.BrowserWindowDisplay", |
+ "Startup.FirstWebContents.MainFrameLoad2", |
+ "Startup.FirstWebContents.MainNavigationFinished", |
+ "Startup.FirstWebContents.MainNavigationStart", |
+ "Startup.FirstWebContents.NonEmptyPaint2", |
+ |
+// These histograms rely on normal browser startup through BrowserMain, |
+// which calls BrowserMainRunnerImpl, which calls ChromeBrowserMainParts |
+// which reports these metrics. |
+// Currently they're not reported at all during browser_tests. |
themblsha
2017/04/19 15:06:09
Should I create a new crbug for this? Fixing this
gab
2017/04/19 18:45:43
Ah, right, let's not bother. Leaving them commente
themblsha
2017/04/20 10:42:23
Done.
Startup.BrowserMessageLoopStartHardFaultCou
|
+ |
+// "Startup.BrowserMessageLoopStartTime", |
+// "Startup.BrowserMessageLoopStartTimeFromMainEntry2", |
+// "Startup.LoadTime.ExeMainToDllMain2", |
+// "Startup.LoadTime.ProcessCreateToDllMain2", |
+// "Startup.LoadTime.ProcessCreateToExeMain2", |
+// "Startup.SystemUptime", |
+ |
+#if defined(OS_WIN) |
+ "Startup.BrowserMessageLoopStartHardFaultCount", |
+ "Startup.Temperature", |
+#endif // defined(OS_WIN) |
+}; |
+ |
+} // namespace |
+ |
+// Verify that startup histograms are logged on browser startup. |
+IN_PROC_BROWSER_TEST_F(StartupMetricsTest, ReportsValues) { |
+ for (auto* const histogram : kStartupMetrics) { |
+ while (!base::StatisticsRecorder::FindHistogram(histogram)) |
+ base::RunLoop().RunUntilIdle(); |
+ } |
+} |