| 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.
|
| +
|
| +// "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();
|
| + }
|
| +}
|
|
|