OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <set> |
| 6 |
| 7 #include "base/metrics/histogram_samples.h" |
| 8 #include "base/metrics/statistics_recorder.h" |
| 9 #include "base/run_loop.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" |
| 11 |
| 12 using StartupMetricsTest = InProcessBrowserTest; |
| 13 |
| 14 namespace { |
| 15 |
| 16 constexpr const char* kStartupMetrics[] = { |
| 17 "Startup.BrowserMainToRendererMain", |
| 18 "Startup.BrowserOpenTabs", |
| 19 "Startup.BrowserWindow.FirstPaint", |
| 20 "Startup.BrowserWindow.FirstPaint.CompositingEnded", |
| 21 "Startup.BrowserWindowDisplay", |
| 22 "Startup.FirstWebContents.MainFrameLoad2", |
| 23 "Startup.FirstWebContents.MainNavigationFinished", |
| 24 "Startup.FirstWebContents.MainNavigationStart", |
| 25 "Startup.FirstWebContents.NonEmptyPaint2", |
| 26 |
| 27 // These histograms rely on normal browser startup through BrowserMain, |
| 28 // which calls BrowserMainRunnerImpl, which calls ChromeBrowserMainParts |
| 29 // which reports these metrics. |
| 30 // Currently they're not reported at all during browser_tests. |
| 31 |
| 32 // "Startup.BrowserMessageLoopStartTime", |
| 33 // "Startup.BrowserMessageLoopStartTimeFromMainEntry2", |
| 34 // "Startup.LoadTime.ExeMainToDllMain2", |
| 35 // "Startup.LoadTime.ProcessCreateToDllMain2", |
| 36 // "Startup.LoadTime.ProcessCreateToExeMain2", |
| 37 // "Startup.SystemUptime", |
| 38 |
| 39 #if defined(OS_WIN) |
| 40 "Startup.BrowserMessageLoopStartHardFaultCount", |
| 41 "Startup.Temperature", |
| 42 #endif // defined(OS_WIN) |
| 43 }; |
| 44 |
| 45 } // namespace |
| 46 |
| 47 // Verify that startup histograms are logged on browser startup. |
| 48 IN_PROC_BROWSER_TEST_F(StartupMetricsTest, ReportsValues) { |
| 49 for (auto* const histogram : kStartupMetrics) { |
| 50 while (!base::StatisticsRecorder::FindHistogram(histogram)) |
| 51 base::RunLoop().RunUntilIdle(); |
| 52 } |
| 53 } |
OLD | NEW |