Chromium Code Reviews| Index: components/scheduler/renderer/task_duration_reporter_unittest.cc |
| diff --git a/components/scheduler/renderer/task_duration_reporter_unittest.cc b/components/scheduler/renderer/task_duration_reporter_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f4bd6da5c2b145f880f285a72b8a62cd84f32b98 |
| --- /dev/null |
| +++ b/components/scheduler/renderer/task_duration_reporter_unittest.cc |
| @@ -0,0 +1,25 @@ |
| +// 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_duration_reporter.h" |
| + |
| +#include "base/test/histogram_tester.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace scheduler { |
| +TEST(TaskDurationReporterTest, LoggingDuration) { |
| + base::HistogramTester tester; |
| + |
| + 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.
|
| + for (int i = 1; i <= 101; ++i) { |
| + 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.
|
| + if (i == 100) { |
| + millisecond = 1; |
| + } |
| + base::TimeDelta duration = base::TimeDelta::FromMilliseconds(millisecond); |
| + tdr.ReportSampleDuration(duration); |
| + } |
| + tester.ExpectUniqueSample("RendererScheduler.TaskDuration", 1, 1); |
| +} |
| +} |