Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(599)

Unified Diff: chrome/browser/ui/views/frame/browser_view_histogram_helper_browsertest.cc

Issue 2773973002: Add Startup.BrowserView.FirstPaint / .CompositingEnded histograms. (Closed)
Patch Set: WasNonBrowserUIDisplayed --> WasMainWindowStartupInterrupted, combine the tests, report trace with … Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
+}

Powered by Google App Engine
This is Rietveld 408576698