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 "base/metrics/histogram_samples.h" |
| 6 #include "base/metrics/statistics_recorder.h" |
| 7 #include "base/run_loop.h" |
| 8 #include "chrome/test/base/in_process_browser_test.h" |
| 9 |
| 10 namespace { |
| 11 |
| 12 const char kStartupBrowserViewFirstPaintHistogramName[] = |
| 13 "Startup.BrowserView.FirstPaint"; |
| 14 const char kStartupBrowserViewFirstPaintCompositingEndedHistogramName[] = |
| 15 "Startup.BrowserView.FirstPaint.CompositingEnded"; |
| 16 |
| 17 } // namespace |
| 18 |
| 19 using BrowserViewHistogramHelperTest = InProcessBrowserTest; |
| 20 |
| 21 // RecordBrowserViewFirstPaint and RecordBrowserViewFirstPaintCompositingEnded |
| 22 // have a static variables inside, so we can't run several tests inside a single |
| 23 // process, and thus these tests cannot be unit_tests. |
| 24 |
| 25 IN_PROC_BROWSER_TEST_F(BrowserViewHistogramHelperTest, FirstPaint) { |
| 26 base::HistogramBase* histogram = nullptr; |
| 27 while (!histogram) { |
| 28 histogram = base::StatisticsRecorder::FindHistogram( |
| 29 kStartupBrowserViewFirstPaintHistogramName); |
| 30 base::RunLoop().RunUntilIdle(); |
| 31 } |
| 32 EXPECT_EQ(1, histogram->SnapshotSamples()->TotalCount()); |
| 33 } |
| 34 |
| 35 IN_PROC_BROWSER_TEST_F(BrowserViewHistogramHelperTest, |
| 36 FirstPaintCompositingEnded) { |
| 37 base::HistogramBase* histogram = nullptr; |
| 38 while (!histogram) { |
| 39 histogram = base::StatisticsRecorder::FindHistogram( |
| 40 kStartupBrowserViewFirstPaintCompositingEndedHistogramName); |
| 41 base::RunLoop().RunUntilIdle(); |
| 42 } |
| 43 EXPECT_EQ(1, histogram->SnapshotSamples()->TotalCount()); |
| 44 } |
OLD | NEW |