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

Unified Diff: chrome/browser/metrics/startup_metrics_browsertest.cc

Issue 2773973002: Add Startup.BrowserView.FirstPaint / .CompositingEnded histograms. (Closed)
Patch Set: BrowserView --> BrowserWindow, use factory method for class creation. 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/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..e7818d5e020d1e38e5dd28a1dcb6c0b0e827a528
--- /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.BrowserWindow.FirstPaint",
+ "Startup.BrowserWindow.FirstPaint.CompositingEnded",
+};
gab 2017/04/18 13:52:15 List all metrics in startup_metrics_utils.cc: con
themblsha 2017/04/19 15:06:09 Done.
+
+} // namespace
+
+// RecordBrowserWindowFirstPaint and
+// RecordBrowserWindowFirstPaintCompositingEnded 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.
gab 2017/04/18 13:52:15 Remove this paragraph (it's obvious now why it's a
themblsha 2017/04/19 15:06:09 Done.
+
+// Tests that the specified startup-specific histograms are indeed reported.
gab 2017/04/18 13:52:15 Change to: // Verify that startup histograms are
themblsha 2017/04/19 15:06:09 Done.
+IN_PROC_BROWSER_TEST_F(StartupMetricsTest, ReportsValues) {
+ for (auto* const histogram : kStartupMetrics) {
+ while (!base::StatisticsRecorder::FindHistogram(histogram))
+ base::RunLoop().RunUntilIdle();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698