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..cfce7da180a1bb40eaa52f0768fad43234c0f5b9 |
| --- /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.BrowserView.FirstPaint", |
| + "Startup.BrowserView.FirstPaint.CompositingEnded", |
| +}; |
| + |
| +} // namespace |
| + |
| +// RecordBrowserViewFirstPaint and RecordBrowserViewFirstPaintCompositingEnded |
| +// 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. |
| + |
| +// Tests that the specified startup-specific histograms are indeed reported. |
| +IN_PROC_BROWSER_TEST_F(StartupMetricsTest, ReportsValues) { |
| + for (auto* const histogram : kStartupMetrics) { |
| + while (!base::StatisticsRecorder::FindHistogram(histogram)) { |
|
sky
2017/04/11 17:13:36
no {}
themblsha
2017/04/12 17:18:28
Done.
|
| + base::RunLoop().RunUntilIdle(); |
| + } |
| + } |
| +} |