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

Unified Diff: components/scheduler/renderer/task_time_reporter_unittest.cc

Issue 2184023002: Report the duration of sampled tasks with histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scheduler_export Created 4 years, 5 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: components/scheduler/renderer/task_time_reporter_unittest.cc
diff --git a/components/scheduler/renderer/task_time_reporter_unittest.cc b/components/scheduler/renderer/task_time_reporter_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5f59a1f6303a77f55969bcc6e4e2fed1ca9dbd53
--- /dev/null
+++ b/components/scheduler/renderer/task_time_reporter_unittest.cc
@@ -0,0 +1,24 @@
+// Copyright 2016 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 "components/scheduler/renderer/task_time_reporter.h"
+
+#include "base/test/histogram_tester.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace scheduler {
+TEST(TaskTimeReporterTest, LoggingTime) {
+ base::HistogramTester tester;
+
+ TaskTimeReporter task_time_reporter;
+ for (int i = 1; i <= 101; ++i) {
+ base::TimeDelta duration = base::TimeDelta::FromMilliseconds(1);
+ if (i == 100) {
+ duration = base::TimeDelta::FromMilliseconds(2);
+ }
+ task_time_reporter.ReportTaskTime(duration);
+ }
+ tester.ExpectUniqueSample("RendererScheduler.TaskTime", 2000, 1);
+}
+}

Powered by Google App Engine
This is Rietveld 408576698