Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/scheduler/renderer/task_duration_reporter.h" | |
| 6 | |
| 7 #include "base/test/histogram_tester.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 | |
| 10 namespace scheduler { | |
| 11 TEST(TaskDurationReporterTest, LoggingDuration) { | |
| 12 base::HistogramTester tester; | |
| 13 | |
| 14 TaskDurationReporter tdr; | |
|
tdresser
2016/07/27 18:04:25
task_duration_reporter
We try to avoid short acro
sunyunjia
2016/07/27 19:51:04
Done.
| |
| 15 for (int i = 1; i <= 101; ++i) { | |
| 16 int millisecond = 5 * 1000; | |
|
tdresser
2016/07/27 18:04:25
Settings this to 5 * 1000 seems a bit odd.
I'd pr
majidvp
2016/07/27 18:34:03
nit: it is better to use a descriptive name such a
sunyunjia
2016/07/27 19:51:04
Done.
sunyunjia
2016/07/27 19:51:04
Done.
| |
| 17 if (i == 100) { | |
| 18 millisecond = 1; | |
| 19 } | |
| 20 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(millisecond); | |
| 21 tdr.ReportSampleDuration(duration); | |
| 22 } | |
| 23 tester.ExpectUniqueSample("RendererScheduler.TaskDuration", 1, 1); | |
| 24 } | |
| 25 } | |
| OLD | NEW |