Chromium Code Reviews| 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..e7818d5e020d1e38e5dd28a1dcb6c0b0e827a528 |
| --- /dev/null |
| +++ b/chrome/browser/metrics/startup_metrics_browsertest.cc |
| @@ -0,0 +1,34 @@ |
| +// 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.BrowserWindow.FirstPaint", |
| + "Startup.BrowserWindow.FirstPaint.CompositingEnded", |
| +}; |
|
gab
2017/04/18 13:52:15
List all metrics in startup_metrics_utils.cc:
con
themblsha
2017/04/19 15:06:09
Done.
|
| + |
| +} // namespace |
| + |
| +// RecordBrowserWindowFirstPaint and |
| +// RecordBrowserWindowFirstPaintCompositingEnded have a static variables inside, |
| +// so we can't run several tests inside a single process, and thus this test |
| +// cannot be in unit_tests. |
|
gab
2017/04/18 13:52:15
Remove this paragraph (it's obvious now why it's a
themblsha
2017/04/19 15:06:09
Done.
|
| + |
| +// Tests that the specified startup-specific histograms are indeed reported. |
|
gab
2017/04/18 13:52:15
Change to:
// Verify that startup histograms are
themblsha
2017/04/19 15:06:09
Done.
|
| +IN_PROC_BROWSER_TEST_F(StartupMetricsTest, ReportsValues) { |
| + for (auto* const histogram : kStartupMetrics) { |
| + while (!base::StatisticsRecorder::FindHistogram(histogram)) |
| + base::RunLoop().RunUntilIdle(); |
| + } |
| +} |