diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-05-20 09:47:09 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-07 11:15:42 +0000 |
commit | 189d4fd8fad9e3c776873be51938cd31a42b6177 (patch) | |
tree | 6497caeff5e383937996768766ab3bb2081a40b2 /chromium/base/task/thread_pool/service_thread_unittest.cc | |
parent | 8bc75099d364490b22f43a7ce366b366c08f4164 (diff) |
BASELINE: Update Chromium to 90.0.4430.221
Change-Id: Iff4d9d18d2fcf1a576f3b1f453010f744a232920
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/base/task/thread_pool/service_thread_unittest.cc')
-rw-r--r-- | chromium/base/task/thread_pool/service_thread_unittest.cc | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/chromium/base/task/thread_pool/service_thread_unittest.cc b/chromium/base/task/thread_pool/service_thread_unittest.cc index 1e04e94e89f..79479666ea6 100644 --- a/chromium/base/task/thread_pool/service_thread_unittest.cc +++ b/chromium/base/task/thread_pool/service_thread_unittest.cc @@ -8,12 +8,6 @@ #include "base/bind.h" #include "base/debug/stack_trace.h" -#include "base/logging.h" -#include "base/task/thread_pool/thread_pool_impl.h" -#include "base/task/thread_pool/thread_pool_instance.h" -#include "base/test/metrics/histogram_tester.h" -#include "base/threading/platform_thread.h" -#include "base/time/time.h" #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" @@ -44,7 +38,7 @@ void VerifyHasStringOnStack(const std::string& query) { #endif TEST(ThreadPoolServiceThreadTest, MAYBE_StackHasIdentifyingFrame) { - ServiceThread service_thread(nullptr); + ServiceThread service_thread; service_thread.Start(); service_thread.task_runner()->PostTask( @@ -53,45 +47,5 @@ TEST(ThreadPoolServiceThreadTest, MAYBE_StackHasIdentifyingFrame) { service_thread.FlushForTesting(); } -// Integration test verifying that a service thread running in a fully -// integrated ThreadPool environment results in reporting -// HeartbeatLatencyMicroseconds metrics. -TEST(ThreadPoolServiceThreadIntegrationTest, HeartbeatLatencyReport) { - ServiceThread::SetHeartbeatIntervalForTesting(TimeDelta::FromMilliseconds(1)); - - ThreadPoolInstance::Set(std::make_unique<internal::ThreadPoolImpl>("Test")); - ThreadPoolInstance::Get()->StartWithDefaultParams(); - - static constexpr const char* kExpectedMetrics[] = { - "ThreadPool.HeartbeatLatencyMicroseconds.Test." - "UserBlockingTaskPriority", - "ThreadPool.HeartbeatLatencyMicroseconds.Test." - "UserVisibleTaskPriority", - "ThreadPool.HeartbeatLatencyMicroseconds.Test." - "BackgroundTaskPriority"}; - - // Each report hits a single histogram above (randomly selected). But 1000 - // reports should touch all histograms at least once the vast majority of the - // time. - constexpr TimeDelta kReasonableTimeout = TimeDelta::FromSeconds(1); - constexpr TimeDelta kBusyWaitTime = TimeDelta::FromMilliseconds(100); - - const TimeTicks start_time = TimeTicks::Now(); - - HistogramTester tester; - for (const char* expected_metric : kExpectedMetrics) { - while (tester.GetAllSamples(expected_metric).empty()) { - if (TimeTicks::Now() - start_time > kReasonableTimeout) - LOG(WARNING) << "Waiting a while for " << expected_metric; - PlatformThread::Sleep(kBusyWaitTime); - } - } - - ThreadPoolInstance::Get()->JoinForTesting(); - ThreadPoolInstance::Set(nullptr); - - ServiceThread::SetHeartbeatIntervalForTesting(TimeDelta()); -} - } // namespace internal } // namespace base |