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

Unified Diff: components/omnibox/browser/history_quick_provider_performance_unittest.cc

Issue 2358063002: Preparing components_perftests (Closed)
Patch Set: Attempt to guess how generate_perf_json.py works Created 4 years, 3 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/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);
+}

Powered by Google App Engine
This is Rietveld 408576698