| Index: chrome/browser/ui/views/frame/browser_view_histogram_helper_browsertest.cc
|
| diff --git a/chrome/browser/ui/views/frame/browser_view_histogram_helper_browsertest.cc b/chrome/browser/ui/views/frame/browser_view_histogram_helper_browsertest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..07d4c2338c4d37cde4cfed3321fcbd4dccff1cf1
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/views/frame/browser_view_histogram_helper_browsertest.cc
|
| @@ -0,0 +1,44 @@
|
| +// 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 "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"
|
| +
|
| +namespace {
|
| +
|
| +const char kStartupBrowserViewFirstPaintHistogramName[] =
|
| + "Startup.BrowserView.FirstPaint";
|
| +const char kStartupBrowserViewFirstPaintCompositingEndedHistogramName[] =
|
| + "Startup.BrowserView.FirstPaint.CompositingEnded";
|
| +
|
| +} // namespace
|
| +
|
| +using BrowserViewHistogramHelperTest = InProcessBrowserTest;
|
| +
|
| +// RecordBrowserViewFirstPaint and RecordBrowserViewFirstPaintCompositingEnded
|
| +// have a static variables inside, so we can't run several tests inside a single
|
| +// process, and thus these tests cannot be unit_tests.
|
| +
|
| +IN_PROC_BROWSER_TEST_F(BrowserViewHistogramHelperTest, FirstPaint) {
|
| + base::HistogramBase* histogram = nullptr;
|
| + while (!histogram) {
|
| + histogram = base::StatisticsRecorder::FindHistogram(
|
| + kStartupBrowserViewFirstPaintHistogramName);
|
| + base::RunLoop().RunUntilIdle();
|
| + }
|
| + EXPECT_EQ(1, histogram->SnapshotSamples()->TotalCount());
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(BrowserViewHistogramHelperTest,
|
| + FirstPaintCompositingEnded) {
|
| + base::HistogramBase* histogram = nullptr;
|
| + while (!histogram) {
|
| + histogram = base::StatisticsRecorder::FindHistogram(
|
| + kStartupBrowserViewFirstPaintCompositingEndedHistogramName);
|
| + base::RunLoop().RunUntilIdle();
|
| + }
|
| + EXPECT_EQ(1, histogram->SnapshotSamples()->TotalCount());
|
| +}
|
|
|