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

Unified Diff: base/debug/task_annotator_unittest.cc

Issue 2973543002: Record task durations on Renderer Main & Compositor threads.
Patch Set: Fix layering issues. Created 3 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: base/debug/task_annotator_unittest.cc
diff --git a/base/debug/task_annotator_unittest.cc b/base/debug/task_annotator_unittest.cc
index bfb0e7c91399310044840276e83f8fc13752d5ca..8ceefab9c16412565c1b5e1d7e368981352a247b 100644
--- a/base/debug/task_annotator_unittest.cc
+++ b/base/debug/task_annotator_unittest.cc
@@ -3,8 +3,11 @@
// found in the LICENSE file.
#include "base/debug/task_annotator.h"
+#include "base/base_switches.h"
#include "base/bind.h"
#include "base/pending_task.h"
+#include "base/test/histogram_tester.h"
+#include "base/test/scoped_command_line.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
@@ -28,5 +31,25 @@ TEST(TaskAnnotatorTest, QueueAndRunTask) {
EXPECT_EQ(123, result);
}
+TEST(TaskAnnotatorTest, TaskTimeHistogram) {
+ base::test::ScopedCommandLine scoped_command_line;
+ base::CommandLine* command_line = scoped_command_line.GetProcessCommandLine();
+ command_line->AppendSwitchASCII(switches::kProfilerTiming, "0");
+
+ // --profiler-timing=0
+ base::PlatformThread::SetName("Compositor");
+
+ HistogramTester histogram_tester;
+ TaskAnnotator annotator;
+
+ int result = 0;
+ PendingTask pending_task(FROM_HERE, BindOnce(&TestTask, &result));
+
+ annotator.DidQueueTask("TaskAnnotatorTest::Queue", pending_task);
+ annotator.RunTask("TaskAnnotatorTest::Queue", &pending_task);
+
+ histogram_tester.ExpectTotalCount("Scheduling.TaskTime.Compositor", 1);
+}
+
} // namespace debug
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698