Commit d3864a14 authored by Wez's avatar Wez Committed by Commit Bot

[base] Reduce TaskEnvironment default Run() timeout.

Reduce the default Run() timeout set by TaskEnvironment from
TestTimeouts::action_max_timeout() to action_timeout(). This typically
reduces the timeout from 30s (45s in Debug) down to 10s.

Sheriffs! This may result in:
- Failures on slow builds, which are not on CQ. Please consider adding
  an #ifdef to restore those builds to action_max_timeout(), rather
  than simply reverting.
- Flakiness in tests which are too close to the new timeout. Please
  consider whether such tests should really be taking so long, and
  whether they can be fixed-forward with a ScopedRunTimeoutForTest
  rather than reverting (see ThroughputAnalyzerTest in this CL).

Bug: 922098
Change-Id: Icd75af79f6d9d3555c91b33ea2566fe7c56cd2f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1548382
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Reviewed-by: default avatarMaks Orlovich <morlovich@chromium.org>
Auto-Submit: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695252}
parent 139f8c9c
...@@ -363,14 +363,13 @@ TaskEnvironment::TaskEnvironment( ...@@ -363,14 +363,13 @@ TaskEnvironment::TaskEnvironment(
: nullptr), : nullptr),
scoped_lazy_task_runner_list_for_testing_( scoped_lazy_task_runner_list_for_testing_(
std::make_unique<internal::ScopedLazyTaskRunnerListForTesting>()), std::make_unique<internal::ScopedLazyTaskRunnerListForTesting>()),
// TODO(https://crbug.com/918724): Enable Run() timeouts even for // TODO(https://crbug.com/922098): Enable Run() timeouts even for
// instances created with *MOCK_TIME, and determine whether the timeout // instances created with *MOCK_TIME.
// can be reduced from action_max_timeout() to action_timeout().
run_loop_timeout_( run_loop_timeout_(
mock_time_domain_ mock_time_domain_
? nullptr ? nullptr
: std::make_unique<RunLoop::ScopedRunTimeoutForTest>( : std::make_unique<RunLoop::ScopedRunTimeoutForTest>(
TestTimeouts::action_max_timeout(), TestTimeouts::action_timeout(),
MakeExpectedNotRunClosure(FROM_HERE, MakeExpectedNotRunClosure(FROM_HERE,
"RunLoop::Run() timed out."))) { "RunLoop::Run() timed out."))) {
CHECK(!base::ThreadTaskRunnerHandle::IsSet()); CHECK(!base::ThreadTaskRunnerHandle::IsSet());
......
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/test/bind_test_util.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/test/simple_test_tick_clock.h" #include "base/test/simple_test_tick_clock.h"
#include "base/test/test_timeouts.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/time/default_tick_clock.h" #include "base/time/default_tick_clock.h"
...@@ -704,6 +706,10 @@ TEST_F(ThroughputAnalyzerTest, TestThroughputWithNetworkRequestsOverlap) { ...@@ -704,6 +706,10 @@ TEST_F(ThroughputAnalyzerTest, TestThroughputWithNetworkRequestsOverlap) {
// of network requests overlap, and the minimum number of in flight requests // of network requests overlap, and the minimum number of in flight requests
// when taking an observation is more than 1. // when taking an observation is more than 1.
TEST_F(ThroughputAnalyzerTest, TestThroughputWithMultipleNetworkRequests) { TEST_F(ThroughputAnalyzerTest, TestThroughputWithMultipleNetworkRequests) {
const base::RunLoop::ScopedRunTimeoutForTest increased_run_timeout(
TestTimeouts::action_max_timeout(),
base::MakeExpectedNotRunClosure(FROM_HERE, "RunLoop::Run() timed out."));
const base::TickClock* tick_clock = base::DefaultTickClock::GetInstance(); const base::TickClock* tick_clock = base::DefaultTickClock::GetInstance();
TestNetworkQualityEstimator network_quality_estimator; TestNetworkQualityEstimator network_quality_estimator;
std::map<std::string, std::string> variation_params; std::map<std::string, std::string> variation_params;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment