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..295b5c9252090b10e0dfe26fa1174340f15570ca |
--- /dev/null |
+++ b/chrome/browser/ui/views/frame/browser_view_histogram_helper_browsertest.cc |
@@ -0,0 +1,41 @@ |
+// 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"; |
gab
2017/04/06 15:30:01
Add all other metrics recorded from components/sta
themblsha
2017/04/10 17:28:19
It wasn't compiling with '[][]' it worked only wit
|
+ |
+} // 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. |
gab
2017/04/06 15:30:01
Singular "test" now that we have just one.
themblsha
2017/04/10 17:28:19
Done.
|
+ |
+IN_PROC_BROWSER_TEST_F(BrowserViewHistogramHelperTest, ReportsValues) { |
+ base::HistogramBase* histogram = nullptr; |
+ while (!histogram) { |
+ histogram = base::StatisticsRecorder::FindHistogram( |
+ kStartupBrowserViewFirstPaintHistogramName); |
+ base::RunLoop().RunUntilIdle(); |
+ } |
+ |
+ histogram = nullptr; |
+ while (!histogram) { |
+ histogram = base::StatisticsRecorder::FindHistogram( |
+ kStartupBrowserViewFirstPaintCompositingEndedHistogramName); |
+ base::RunLoop().RunUntilIdle(); |
+ } |
+ |
+ EXPECT_EQ(1, histogram->SnapshotSamples()->TotalCount()); |
+} |