| Index: components/omnibox/browser/history_quick_provider_performance_unittest.cc
|
| diff --git a/components/omnibox/browser/history_quick_provider_performance_unittest.cc b/components/omnibox/browser/history_quick_provider_performance_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..43df579f7bbfd19975be3d338e4d06c244a3883f
|
| --- /dev/null
|
| +++ b/components/omnibox/browser/history_quick_provider_performance_unittest.cc
|
| @@ -0,0 +1,37 @@
|
| +// 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 "base/time/time.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +#include "testing/perf/perf_test.h"
|
| +
|
| +namespace {
|
| +base::TimeDelta EmptyActivity() {
|
| + base::Time regular_start = base::Time::Now();
|
| + base::ThreadTicks thread_start;
|
| + if (base::ThreadTicks::IsSupported())
|
| + thread_start = base::ThreadTicks::Now();
|
| +
|
| + LOG(INFO) << "Activly do nothing";
|
| +
|
| + if (base::ThreadTicks::IsSupported())
|
| + return base::ThreadTicks::Now() - thread_start;
|
| +
|
| + return base::Time::Now() - regular_start;
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| +TEST(BlankPerfTest, BlankActivity) {
|
| + auto test_info = ::testing::UnitTest::GetInstance()->current_test_info();
|
| +
|
| + const std::size_t kRepeatCount = 10;
|
| +
|
| + std::string durations;
|
| + for (std::size_t i = 0; i < kRepeatCount; ++i)
|
| + durations += std::to_string(EmptyActivity().InMicroseconds()) + ',';
|
| +
|
| + perf_test::PrintResultList(test_info->test_case_name(), test_info->name(),
|
| + "trace", durations, "ms", true);
|
| +}
|
|
|