0

[TaskEnvironment] Mass-migrate away from ScopedTaskEnvironment

(second half of
 https://chromium-review.googlesource.com/c/chromium/src/+/1756247)

This is step  of the mass migration. Some of these will be
backported to SingleThreadTaskEnvironment in a later phase.

scoped_task_environment.h will also only move in a follow-up CL.

TBR=dcheng@chromium.org

Bug: 992483
Change-Id: Ie80f083eeeb209180ab3c2884f1b566f73549cc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1756248
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688142}
This commit is contained in:
Gabriel Charette
2019-08-19 17:30:11 +00:00
committed by Commit Bot
parent 855f22bd33
commit dfa3604eca
1122 changed files with 3162 additions and 3370 deletions
PRESUBMIT.py
android_webview
base/util/memory_pressure
chrome/browser
notifications
ui
components
arc
assist_ranker
autofill
autofill_assistant
blacklist
bookmarks
browser_watcher
browsing_data
captive_portal
cast_channel
certificate_transparency
chromeos_camera
component_updater
consent_auditor
content_capture
content_settings
crash
cronet
data_reduction_proxy
discardable_memory
dom_distiller
domain_reliability
download
drive
exo
favicon
feature_engagement
feed
gcm_driver
history
image_fetcher
invalidation
language
leveldb_proto
media_message_center
metrics
mirroring
nacl
net_log
network_time
ntp_snippets
ntp_tiles
offline_pages
omnibox
optimization_guide
os_crypt
page_image_annotation
password_manager
payments
policy
prefs
previews
proxy_config
rappor
reading_list
rlz
safe_browsing
safe_search_api
search_provider_logos
send_tab_to_self
services
signin
spellcheck
ssl_errors
storage_monitor
subresource_filter
suggestions
sync
base
driver
engine
engine_impl
js
model
model_impl
syncable
sync_bookmarks
sync_device_info
sync_sessions
sync_user_events
timers
tracing
translate
ui_devtools
ukm
unified_consent
update_client
upload_list
url_formatter
variations
viz
web_resource
fuchsia/engine/browser
google_apis
gpu
ios
chrome
components
net
web
web_view
ipc
jingle
media
audio
base
blink
capabilities
capture
cast
cdm
device_monitors
filters
gpu
learning
midi
mojo
remoting
renderers
test
webrtc
mojo
ppapi
printing
remoting
base
client
host
chromeos
chromoting_host_context_unittest.ccchromoting_host_unittest.ccclient_session_unittest.ccconfig_file_watcher_unittest.ccdaemon_process_unittest.ccdesktop_process_unittest.ccdesktop_session_agent_unittest.cc
file_transfer
ftl_host_change_notification_listener_unittest.ccftl_signaling_connector_unittest.ccgcd_rest_client_unittest.ccgcd_state_updater_unittest.ccheartbeat_sender_unittest.cchost_power_save_blocker_unittest.cchost_status_logger_unittest.cc
input_monitor
ipc_desktop_environment_unittest.cc
it2me
linux
mouse_cursor_monitor_proxy_unittest.ccmouse_shape_pump_unittest.cc
native_messaging
policy_watcher_unittest.ccprocess_stats_sender_unittest.ccremoting_register_support_host_request_unittest.ccresizing_host_observer_unittest.cc
security_key
token_validator_factory_impl_unittest.cc
win
xmpp_register_support_host_request_unittest.cc
ios
protocol
signaling
test
rlz
sandbox/mac/mojom
services
audio
content
data_decoder
device
identity
image_annotation
media_session
network
cert_verifier_with_trust_anchors_unittest.ccchunked_data_pipe_upload_data_stream_unittest.cccookie_manager_unittest.cc
cors
cross_origin_read_blocking_unittest.ccdata_pipe_element_reader_unittest.ccdns_config_change_manager_unittest.ccexpect_ct_reporter_unittest.cchost_resolver_unittest.cchttp_cache_data_counter_unittest.cchttp_cache_data_remover_unittest.ccmdns_responder_unittest.ccmojo_host_resolver_impl_unittest.ccnetwork_change_manager_unittest.ccnetwork_context_unittest.ccnetwork_qualities_pref_delegate_unittest.ccnetwork_quality_estimator_manager_unittest.ccnetwork_service_proxy_delegate_unittest.ccnetwork_service_unittest.cc
origin_policy
p2p
proxy_config_service_mojo_unittest.ccproxy_resolver_factory_mojo_unittest.ccproxy_resolving_client_socket_unittest.ccproxy_resolving_socket_mojo_unittest.cc
public
resource_scheduler
restricted_cookie_manager_unittest.ccsec_header_helpers_unittest.ccsession_cleanup_cookie_store_unittest.ccsocket_data_pump_unittest.ccssl_config_service_mojo_unittest.cctcp_bound_socket_unittest.cctcp_socket_unittest.cc
test
throttling
tls_client_socket_unittest.cctransitional_url_loader_factory_owner_unittest.ccudp_socket_unittest.ccurl_loader_unittest.ccwebsocket_throttler_unittest.cc
preferences
proxy_resolver
resource_coordinator
memory_instrumentation
service_manager
shape_detection
tracing
video_capture
viz
skia/public/mojom/test
storage/browser
third_party/blink
ui
android
aura
base
compositor
display
events
gfx
gl
latency
message_center
ozone
shell_dialogs
snapshot
views
url/mojom

@@ -714,7 +714,7 @@ _BANNED_CPP_FUNCTIONS = (
'base::ScopedMockTimeMessageLoopTaskRunner', 'base::ScopedMockTimeMessageLoopTaskRunner',
( (
'ScopedMockTimeMessageLoopTaskRunner is deprecated. Prefer', 'ScopedMockTimeMessageLoopTaskRunner is deprecated. Prefer',
'ScopedTaskEnvironment::TimeSource::MOCK_TIME. There are still a', 'TaskEnvironment::TimeSource::MOCK_TIME. There are still a',
'few cases that may require a ScopedMockTimeMessageLoopTaskRunner', 'few cases that may require a ScopedMockTimeMessageLoopTaskRunner',
'(i.e. mocking the main MessageLoopForUI in browser_tests), but check', '(i.e. mocking the main MessageLoopForUI in browser_tests), but check',
'with gab@ first if you think you need it)', 'with gab@ first if you think you need it)',

@@ -17,7 +17,7 @@ class AwContentBrowserClientTest : public testing::Test {
mojo::core::Init(); mojo::core::Init();
} }
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
}; };
TEST_F(AwContentBrowserClientTest, DisableCreatingThreadPool) { TEST_F(AwContentBrowserClientTest, DisableCreatingThreadPool) {

@@ -37,11 +37,11 @@ class AwFormDatabaseServiceTest : public Test {
void TearDown() override { void TearDown() override {
service_->Shutdown(); service_->Shutdown();
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
} }
// The path to the temporary directory used for the test operations. // The path to the temporary directory used for the test operations.
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
base::ScopedTempDir temp_dir_; base::ScopedTempDir temp_dir_;
JNIEnv* env_; JNIEnv* env_;
std::unique_ptr<AwFormDatabaseService> service_; std::unique_ptr<AwFormDatabaseService> service_;

@@ -65,7 +65,7 @@ class AwMetricsServiceClientTest : public testing::Test {
~AwMetricsServiceClientTest() override {} ~AwMetricsServiceClientTest() override {}
private: private:
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
scoped_refptr<base::TestSimpleTaskRunner> task_runner_; scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
DISALLOW_COPY_AND_ASSIGN(AwMetricsServiceClientTest); DISALLOW_COPY_AND_ASSIGN(AwMetricsServiceClientTest);

@@ -233,7 +233,7 @@ class AndroidStreamReaderURLLoaderTest : public ::testing::Test {
return std::string(buffer.data(), buffer.size()); return std::string(buffer.data(), buffer.size());
} }
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
DISALLOW_COPY_AND_ASSIGN(AndroidStreamReaderURLLoaderTest); DISALLOW_COPY_AND_ASSIGN(AndroidStreamReaderURLLoaderTest);
}; };

@@ -30,8 +30,8 @@ class AwSafeBrowsingWhitelistManagerTest : public testing::Test {
void SetWhitelist(std::vector<std::string>&& whitelist, bool expected); void SetWhitelist(std::vector<std::string>&& whitelist, bool expected);
base::test::ScopedTaskEnvironment scoped_task_environment_{ base::test::TaskEnvironment task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::IO}; base::test::TaskEnvironment::MainThreadType::IO};
std::unique_ptr<AwSafeBrowsingWhitelistManager> wm_; std::unique_ptr<AwSafeBrowsingWhitelistManager> wm_;
}; };

@@ -19,8 +19,8 @@ jboolean JNI_MemoryMetricsLoggerTest_ForceRecordHistograms(JNIEnv* env) {
return false; return false;
TestTimeouts::Initialize(); TestTimeouts::Initialize();
base::test::ScopedTaskEnvironment scoped_task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY); base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY);
base::RunLoop run_loop; base::RunLoop run_loop;
bool result = false; bool result = false;
memory_metrics_logger->ScheduleRecordForTesting( memory_metrics_logger->ScheduleRecordForTesting(

@@ -12,7 +12,7 @@
namespace util { namespace util {
TEST(MultiSourceMemoryPressureMonitorTest, RunDispatchCallback) { TEST(MultiSourceMemoryPressureMonitorTest, RunDispatchCallback) {
base::test::ScopedTaskEnvironment task_environment; base::test::TaskEnvironment task_environment;
MultiSourceMemoryPressureMonitor monitor; MultiSourceMemoryPressureMonitor monitor;
auto* aggregator = monitor.aggregator_for_testing(); auto* aggregator = monitor.aggregator_for_testing();

@@ -49,7 +49,7 @@ class IconConverterTest : public testing::Test {
std::vector<std::string>* encoded_data() { return &encoded_data_; } std::vector<std::string>* encoded_data() { return &encoded_data_; }
private: private:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
std::unique_ptr<IconConverter> icon_converter_; std::unique_ptr<IconConverter> icon_converter_;
std::vector<std::string> encoded_data_; std::vector<std::string> encoded_data_;
std::vector<SkBitmap> decoded_icons_; std::vector<SkBitmap> decoded_icons_;

@@ -139,7 +139,7 @@ class AnimatingLayoutManagerSteppingTest : public testing::Test {
View* view_; View* view_;
std::vector<View*> children_; std::vector<View*> children_;
AnimatingLayoutManager* animating_layout_manager_ = nullptr; AnimatingLayoutManager* animating_layout_manager_ = nullptr;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
std::unique_ptr<gfx::AnimationContainerTestApi> container_test_api_; std::unique_ptr<gfx::AnimationContainerTestApi> container_test_api_;
}; };

@@ -103,7 +103,7 @@ class ArcPowerBridgeTest : public testing::Test {
return chromeos::FakePowerManagerClient::Get(); return chromeos::FakePowerManagerClient::Get();
} }
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
service_manager::TestConnectorFactory connector_factory_; service_manager::TestConnectorFactory connector_factory_;

@@ -72,7 +72,7 @@ class ArcDataRemoverTest : public testing::Test {
private: private:
TestingPrefServiceSimple prefs_; TestingPrefServiceSimple prefs_;
const cryptohome::Identification cryptohome_id_{EmptyAccountId()}; const cryptohome::Identification cryptohome_id_{EmptyAccountId()};
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
std::unique_ptr<TestUpstartClient> test_upstart_client_; std::unique_ptr<TestUpstartClient> test_upstart_client_;
DISALLOW_COPY_AND_ASSIGN(ArcDataRemoverTest); DISALLOW_COPY_AND_ASSIGN(ArcDataRemoverTest);

@@ -224,7 +224,7 @@ class ArcSessionImplTest : public testing::Test {
} }
private: private:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
user_manager::ScopedUserManager scoped_user_manager_{ user_manager::ScopedUserManager scoped_user_manager_{
std::make_unique<user_manager::FakeUserManager>()}; std::make_unique<user_manager::FakeUserManager>()};

@@ -56,8 +56,7 @@ class ArcSessionRunnerTest : public testing::Test,
public ArcSessionRunner::Observer { public ArcSessionRunner::Observer {
public: public:
ArcSessionRunnerTest() ArcSessionRunnerTest()
: scoped_task_environment_( : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {}
base::test::ScopedTaskEnvironment::MainThreadType::UI) {}
void SetUp() override { void SetUp() override {
chromeos::SessionManagerClient::InitializeFakeInMemory(); chromeos::SessionManagerClient::InitializeFakeInMemory();
@@ -137,7 +136,7 @@ class ArcSessionRunnerTest : public testing::Test,
bool stopped_called_; bool stopped_called_;
bool restarting_called_; bool restarting_called_;
std::unique_ptr<ArcSessionRunner> arc_session_runner_; std::unique_ptr<ArcSessionRunner> arc_session_runner_;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
DISALLOW_COPY_AND_ASSIGN(ArcSessionRunnerTest); DISALLOW_COPY_AND_ASSIGN(ArcSessionRunnerTest);
}; };

@@ -27,8 +27,7 @@ using device::mojom::WakeLockType;
class ArcWakeLockBridgeTest : public testing::Test { class ArcWakeLockBridgeTest : public testing::Test {
public: public:
ArcWakeLockBridgeTest() ArcWakeLockBridgeTest()
: scoped_task_environment_( : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME),
base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME),
wake_lock_provider_( wake_lock_provider_(
connector_factory_.RegisterInstance(device::mojom::kServiceName)) { connector_factory_.RegisterInstance(device::mojom::kServiceName)) {
bridge_service_ = std::make_unique<ArcBridgeService>(); bridge_service_ = std::make_unique<ArcBridgeService>();
@@ -98,7 +97,7 @@ class ArcWakeLockBridgeTest : public testing::Test {
} }
private: private:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
service_manager::TestConnectorFactory connector_factory_; service_manager::TestConnectorFactory connector_factory_;
device::TestWakeLockProvider wake_lock_provider_; device::TestWakeLockProvider wake_lock_provider_;

@@ -113,7 +113,7 @@ class BasePredictorTest : public ::testing::Test {
private: private:
// Sets up the task scheduling/task-runner environment for each test. // Sets up the task scheduling/task-runner environment for each test.
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
// Sets itself as the global UkmRecorder on construction. // Sets itself as the global UkmRecorder on construction.
ukm::TestAutoSetUkmRecorder test_ukm_recorder_; ukm::TestAutoSetUkmRecorder test_ukm_recorder_;

@@ -76,7 +76,7 @@ class RankerModelLoaderImplTest : public ::testing::Test {
void OnModelAvailable(std::unique_ptr<RankerModel> model); void OnModelAvailable(std::unique_ptr<RankerModel> model);
// Sets up the task scheduling/task-runner environment for each test. // Sets up the task scheduling/task-runner environment for each test.
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
// Override the default URL loader to return custom responses for tests. // Override the default URL loader to return custom responses for tests.
network::TestURLLoaderFactory test_loader_factory_; network::TestURLLoaderFactory test_loader_factory_;
@@ -175,7 +175,7 @@ bool RankerModelLoaderImplTest::DoLoaderTest(const base::FilePath& model_path,
test_shared_loader_factory_, model_path, model_url, test_shared_loader_factory_, model_path, model_url,
"RankerModelLoaderImplTest"); "RankerModelLoaderImplTest");
loader->NotifyOfRankerActivity(); loader->NotifyOfRankerActivity();
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
return true; return true;
} }

@@ -102,7 +102,7 @@ class TestLogger : public RendererSavePasswordProgressLogger {
} // namespace } // namespace
TEST(RendererSavePasswordProgressLoggerTest, SendLog) { TEST(RendererSavePasswordProgressLoggerTest, SendLog) {
base::test::ScopedTaskEnvironment task_environment; base::test::TaskEnvironment task_environment;
FakeContentPasswordManagerDriver fake_driver; FakeContentPasswordManagerDriver fake_driver;
mojom::PasswordManagerDriverPtr driver_ptr = mojom::PasswordManagerDriverPtr driver_ptr =
fake_driver.CreateInterfacePtrAndBind(); fake_driver.CreateInterfacePtrAndBind();

@@ -94,7 +94,7 @@ class AddressNormalizerTest : public testing::Test {
~AddressNormalizerTest() override {} ~AddressNormalizerTest() override {}
void WaitForAddressValidatorInitialization() { void WaitForAddressValidatorInitialization() {
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
} }
bool normalization_successful() const { return success_; } bool normalization_successful() const { return success_; }
@@ -103,7 +103,7 @@ class AddressNormalizerTest : public testing::Test {
TestAddressNormalizer* normalizer() { return &normalizer_; } TestAddressNormalizer* normalizer() { return &normalizer_; }
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
bool AreRulesLoadedForRegion(const std::string& region_code) { bool AreRulesLoadedForRegion(const std::string& region_code) {
return normalizer_.AreRulesLoadedForRegion(region_code); return normalizer_.AreRulesLoadedForRegion(region_code);
@@ -187,7 +187,7 @@ TEST_F(AddressNormalizerTest,
base::Unretained(this))); base::Unretained(this)));
// Let the timeout execute. // Let the timeout execute.
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
// Since the rules are never loaded and the timeout is 0, the callback should // Since the rules are never loaded and the timeout is 0, the callback should
// get notified that the address could not be normalized. // get notified that the address could not be normalized.
@@ -338,7 +338,7 @@ TEST_F(AddressNormalizerTest, FormatPhone_AddressNotNormalizedAsync) {
base::Unretained(this))); base::Unretained(this)));
// Let the timeout execute. // Let the timeout execute.
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
// Make sure the address was not normalized. // Make sure the address was not normalized.
EXPECT_FALSE(normalization_successful()); EXPECT_FALSE(normalization_successful());

@@ -150,7 +150,7 @@ class AutocompleteHistoryManagerTest : public testing::Test {
date_last_used); date_last_used);
} }
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
scoped_refptr<MockWebDataService> web_data_service_; scoped_refptr<MockWebDataService> web_data_service_;
std::unique_ptr<AutocompleteHistoryManager> autocomplete_manager_; std::unique_ptr<AutocompleteHistoryManager> autocomplete_manager_;
std::unique_ptr<PrefService> prefs_; std::unique_ptr<PrefService> prefs_;

@@ -148,7 +148,7 @@ class AutofillAssistantTest : public testing::Test {
return static_cast<CardUnmaskDelegate*>(full_card_request); return static_cast<CardUnmaskDelegate*>(full_card_request);
} }
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
TestAutofillClient autofill_client_; TestAutofillClient autofill_client_;
testing::NiceMock<TestAutofillDriver> autofill_driver_; testing::NiceMock<TestAutofillDriver> autofill_driver_;
TestPersonalDataManager pdm_; TestPersonalDataManager pdm_;

@@ -251,7 +251,7 @@ class AutofillDownloadManagerTest : public AutofillDownloadManager::Observer,
}; };
ScopedActiveAutofillExperiments scoped_active_autofill_experiments; ScopedActiveAutofillExperiments scoped_active_autofill_experiments;
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
std::list<ResponseData> responses_; std::list<ResponseData> responses_;
scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_;
network::TestURLLoaderFactory test_url_loader_factory_; network::TestURLLoaderFactory test_url_loader_factory_;
@@ -1492,8 +1492,8 @@ class AutofillServerCommunicationTest
return succeeded; return succeeded;
} }
base::test::ScopedTaskEnvironment scoped_task_environment_{ base::test::TaskEnvironment task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::IO}; base::test::TaskEnvironment::MainThreadType::IO};
base::test::ScopedCommandLine scoped_command_line_; base::test::ScopedCommandLine scoped_command_line_;
base::test::ScopedFeatureList scoped_feature_list_1_; base::test::ScopedFeatureList scoped_feature_list_1_;
base::test::ScopedFeatureList scoped_feature_list_2_; base::test::ScopedFeatureList scoped_feature_list_2_;

@@ -100,7 +100,7 @@ class AutofillDriverFactoryTest : public testing::Test {
protected: protected:
// For TestAutofillDriver. // For TestAutofillDriver.
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
MockAutofillClient client_; MockAutofillClient client_;

@@ -181,7 +181,7 @@ class AutofillExternalDelegateUnitTest : public testing::Test {
kQueryId, suggestions, /*autoselect_first_suggestion=*/false); kQueryId, suggestions, /*autoselect_first_suggestion=*/false);
} }
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
testing::NiceMock<MockAutofillClient> autofill_client_; testing::NiceMock<MockAutofillClient> autofill_client_;
std::unique_ptr<testing::NiceMock<MockAutofillDriver>> autofill_driver_; std::unique_ptr<testing::NiceMock<MockAutofillDriver>> autofill_driver_;

@@ -589,7 +589,7 @@ class AutofillManagerTest : public testing::Test {
} }
protected: protected:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
MockAutofillClient autofill_client_; MockAutofillClient autofill_client_;
std::unique_ptr<MockAutofillDriver> autofill_driver_; std::unique_ptr<MockAutofillDriver> autofill_driver_;
std::unique_ptr<TestAutofillManager> autofill_manager_; std::unique_ptr<TestAutofillManager> autofill_manager_;

@@ -183,7 +183,7 @@ class AutofillMergeTest : public DataDrivenTest,
// Deserializes |str| into a field type. // Deserializes |str| into a field type.
ServerFieldType StringToFieldType(const std::string& str); ServerFieldType StringToFieldType(const std::string& str);
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
TestAutofillClient autofill_client_; TestAutofillClient autofill_client_;
PersonalDataManagerMock personal_data_; PersonalDataManagerMock personal_data_;
std::unique_ptr<FormDataImporter> form_data_importer_; std::unique_ptr<FormDataImporter> form_data_importer_;

@@ -283,7 +283,7 @@ class AutofillMetricsTest : public testing::Test {
// Purge recorded UKM metrics for running more tests. // Purge recorded UKM metrics for running more tests.
void PurgeUKM(); void PurgeUKM();
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
MockAutofillClient autofill_client_; MockAutofillClient autofill_client_;
ukm::TestUkmRecorder* test_ukm_recorder_; ukm::TestUkmRecorder* test_ukm_recorder_;
syncer::TestSyncService sync_service_; syncer::TestSyncService sync_service_;

@@ -105,7 +105,7 @@ class AutofillProfileValidatorTest : public testing::Test {
expected_validity_; expected_validity_;
private: private:
base::test::ScopedTaskEnvironment scoped_task_scheduler; base::test::TaskEnvironment scoped_task_scheduler;
DISALLOW_COPY_AND_ASSIGN(AutofillProfileValidatorTest); DISALLOW_COPY_AND_ASSIGN(AutofillProfileValidatorTest);
}; };

@@ -758,14 +758,14 @@ class AutofillSelectWithStatesTest
std::unique_ptr<Storage>(new NullStorage), "en-US"); std::unique_ptr<Storage>(new NullStorage), "en-US");
// Make sure the normalizer is done initializing its member(s) in // Make sure the normalizer is done initializing its member(s) in
// background task(s). // background task(s).
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
} }
protected: protected:
AddressNormalizer* normalizer() { return normalizer_.get(); } AddressNormalizer* normalizer() { return normalizer_.get(); }
private: private:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
std::unique_ptr<AddressNormalizerImpl> normalizer_; std::unique_ptr<AddressNormalizerImpl> normalizer_;
DISALLOW_COPY_AND_ASSIGN(AutofillSelectWithStatesTest); DISALLOW_COPY_AND_ASSIGN(AutofillSelectWithStatesTest);

@@ -223,8 +223,8 @@ class FormDataImporterTestBase {
run_loop.Run(); run_loop.Run();
} }
base::test::ScopedTaskEnvironment task_environment_{ base::test::TaskEnvironment task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::UI}; base::test::TaskEnvironment::MainThreadType::UI};
std::unique_ptr<PrefService> prefs_; std::unique_ptr<PrefService> prefs_;
scoped_refptr<AutofillWebDataService> autofill_database_service_; scoped_refptr<AutofillWebDataService> autofill_database_service_;
scoped_refptr<WebDatabaseService> web_database_; scoped_refptr<WebDatabaseService> web_database_;

@@ -102,7 +102,7 @@ class SubKeyRequesterTest : public testing::Test {
~SubKeyRequesterTest() override {} ~SubKeyRequesterTest() override {}
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
std::unique_ptr<TestSubKeyRequester> requester_; std::unique_ptr<TestSubKeyRequester> requester_;
private: private:
@@ -157,7 +157,7 @@ TEST_F(SubKeyRequesterTest, StartRequest_RulesNotLoaded_WillNotLoad) {
requester_->StartRegionSubKeysRequest(kLocale, kLanguage, 0, std::move(cb)); requester_->StartRegionSubKeysRequest(kLocale, kLanguage, 0, std::move(cb));
// Let the timeout execute. // Let the timeout execute.
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
// Since the rules are never loaded and the timeout is 0, the delegate should // Since the rules are never loaded and the timeout is 0, the delegate should
// get notified that the subkeys could not be received. // get notified that the subkeys could not be received.

@@ -148,7 +148,7 @@ class AutofillWalletDataTypeControllerTest : public testing::Test {
last_error_ = error; last_error_ = error;
} }
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
TestingPrefServiceSimple prefs_; TestingPrefServiceSimple prefs_;
syncer::UserShare user_share_; syncer::UserShare user_share_;
testing::NiceMock<syncer::MockSyncService> sync_service_; testing::NiceMock<syncer::MockSyncService> sync_service_;

@@ -141,10 +141,9 @@ std::string NextMonth() {
class CreditCardAccessManagerTest : public testing::Test { class CreditCardAccessManagerTest : public testing::Test {
public: public:
CreditCardAccessManagerTest() CreditCardAccessManagerTest()
: scoped_task_environment_( : task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::DEFAULT, base::test::TaskEnvironment::MainThreadType::DEFAULT,
base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode:: base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED) {}
QUEUED) {}
void SetUp() override { void SetUp() override {
autofill_client_.SetPrefs(test::PrefServiceForTesting()); autofill_client_.SetPrefs(test::PrefServiceForTesting());
@@ -283,11 +282,11 @@ class CreditCardAccessManagerTest : public testing::Test {
credit_card_access_manager_->ready_to_start_authentication_.Signal(); credit_card_access_manager_->ready_to_start_authentication_.Signal();
} }
void WaitForCallbacks() { scoped_task_environment_.RunUntilIdle(); } void WaitForCallbacks() { task_environment_.RunUntilIdle(); }
protected: protected:
std::unique_ptr<TestAccessor> accessor_; std::unique_ptr<TestAccessor> accessor_;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
payments::TestPaymentsClient* payments_client_; payments::TestPaymentsClient* payments_client_;
TestAutofillClient autofill_client_; TestAutofillClient autofill_client_;
std::unique_ptr<TestAutofillDriver> autofill_driver_; std::unique_ptr<TestAutofillDriver> autofill_driver_;

@@ -151,7 +151,7 @@ class CreditCardCVCAuthenticatorTest : public testing::Test {
protected: protected:
std::unique_ptr<TestAuthenticationRequester> requester_; std::unique_ptr<TestAuthenticationRequester> requester_;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
TestAutofillClient autofill_client_; TestAutofillClient autofill_client_;
std::unique_ptr<TestAutofillDriver> autofill_driver_; std::unique_ptr<TestAutofillDriver> autofill_driver_;
scoped_refptr<AutofillWebDataService> database_; scoped_refptr<AutofillWebDataService> database_;

@@ -225,7 +225,7 @@ class CreditCardFIDOAuthenticatorTest : public testing::Test {
protected: protected:
std::unique_ptr<TestAuthenticationRequester> requester_; std::unique_ptr<TestAuthenticationRequester> requester_;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
TestAutofillClient autofill_client_; TestAutofillClient autofill_client_;
std::unique_ptr<TestAutofillDriver> autofill_driver_; std::unique_ptr<TestAutofillDriver> autofill_driver_;
scoped_refptr<AutofillWebDataService> database_; scoped_refptr<AutofillWebDataService> database_;

@@ -349,7 +349,7 @@ class CreditCardSaveManagerTest : public testing::Test {
} }
protected: protected:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
TestAutofillClient autofill_client_; TestAutofillClient autofill_client_;
std::unique_ptr<TestAutofillDriver> autofill_driver_; std::unique_ptr<TestAutofillDriver> autofill_driver_;
std::unique_ptr<TestAutofillManager> autofill_manager_; std::unique_ptr<TestAutofillManager> autofill_manager_;

@@ -107,7 +107,7 @@ class FullCardRequestTest : public testing::Test {
} }
private: private:
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
MockPersonalDataManager personal_data_; MockPersonalDataManager personal_data_;
MockResultDelegate result_delegate_; MockResultDelegate result_delegate_;
MockUIDelegate ui_delegate_; MockUIDelegate ui_delegate_;

@@ -305,7 +305,7 @@ class LocalCardMigrationManagerTest : public testing::Test {
} }
protected: protected:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
TestAutofillClient autofill_client_; TestAutofillClient autofill_client_;
std::unique_ptr<TestAutofillDriver> autofill_driver_; std::unique_ptr<TestAutofillDriver> autofill_driver_;
std::unique_ptr<TestAutofillManager> autofill_manager_; std::unique_ptr<TestAutofillManager> autofill_manager_;

@@ -318,7 +318,7 @@ class PaymentsClientTest : public testing::Test {
// A tip message to be displayed during local card migration. // A tip message to be displayed during local card migration.
std::string display_text_; std::string display_text_;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
network::TestURLLoaderFactory test_url_loader_factory_; network::TestURLLoaderFactory test_url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_;
TestPersonalDataManager test_personal_data_; TestPersonalDataManager test_personal_data_;

@@ -43,12 +43,12 @@ class StrikeDatabaseIntegratorTestStrikeDatabaseTest : public ::testing::Test {
// to a task runner, requires running the loop to complete. // to a task runner, requires running the loop to complete.
strike_database_.reset(); strike_database_.reset();
strike_database_service_.reset(); strike_database_service_.reset();
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
} }
protected: protected:
base::HistogramTester* GetHistogramTester() { return &histogram_tester_; } base::HistogramTester* GetHistogramTester() { return &histogram_tester_; }
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
base::ScopedTempDir temp_dir_; base::ScopedTempDir temp_dir_;
std::unique_ptr<leveldb_proto::ProtoDatabaseProvider> db_provider_; std::unique_ptr<leveldb_proto::ProtoDatabaseProvider> db_provider_;
std::unique_ptr<StrikeDatabase> strike_database_service_; std::unique_ptr<StrikeDatabase> strike_database_service_;

@@ -129,7 +129,7 @@ class StrikeDatabaseTest : public ::testing::Test {
protected: protected:
base::HistogramTester* GetHistogramTester() { return &histogram_tester_; } base::HistogramTester* GetHistogramTester() { return &histogram_tester_; }
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
std::unique_ptr<leveldb_proto::ProtoDatabaseProvider> db_provider_; std::unique_ptr<leveldb_proto::ProtoDatabaseProvider> db_provider_;
std::unique_ptr<TestStrikeDatabase> strike_database_; std::unique_ptr<TestStrikeDatabase> strike_database_;
base::ScopedTempDir temp_dir_; base::ScopedTempDir temp_dir_;

@@ -297,8 +297,8 @@ class PersonalDataManagerTestBase {
run_loop.Run(); run_loop.Run();
} }
base::test::ScopedTaskEnvironment task_environment_{ base::test::TaskEnvironment task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::UI}; base::test::TaskEnvironment::MainThreadType::UI};
std::unique_ptr<PrefService> prefs_; std::unique_ptr<PrefService> prefs_;
network::TestURLLoaderFactory test_url_loader_factory_; network::TestURLLoaderFactory test_url_loader_factory_;
signin::IdentityTestEnvironment identity_test_env_; signin::IdentityTestEnvironment identity_test_env_;

@@ -293,7 +293,7 @@ class AutocompleteSyncBridgeTest : public testing::Test {
private: private:
ScopedTempDir temp_dir_; ScopedTempDir temp_dir_;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
testing::NiceMock<MockAutofillWebDataBackend> backend_; testing::NiceMock<MockAutofillWebDataBackend> backend_;
AutofillTable table_; AutofillTable table_;
WebDatabase db_; WebDatabase db_;

@@ -321,7 +321,7 @@ class AutofillProfileSyncBridgeTest : public testing::Test {
private: private:
autofill::TestAutofillClock test_clock_; autofill::TestAutofillClock test_clock_;
ScopedTempDir temp_dir_; ScopedTempDir temp_dir_;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
testing::NiceMock<MockAutofillWebDataBackend> backend_; testing::NiceMock<MockAutofillWebDataBackend> backend_;
AutofillTable table_; AutofillTable table_;
WebDatabase db_; WebDatabase db_;

@@ -107,7 +107,7 @@ class AutofillProfileSyncDifferenceTrackerTestBase : public testing::Test {
private: private:
autofill::TestAutofillClock test_clock_; autofill::TestAutofillClock test_clock_;
base::ScopedTempDir temp_dir_; base::ScopedTempDir temp_dir_;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
AutofillTable table_; AutofillTable table_;
WebDatabase db_; WebDatabase db_;

@@ -452,7 +452,7 @@ class AutofillWalletMetadataSyncBridgeTest : public testing::Test {
int response_version = 0; int response_version = 0;
autofill::TestAutofillClock test_clock_; autofill::TestAutofillClock test_clock_;
ScopedTempDir temp_dir_; ScopedTempDir temp_dir_;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
testing::NiceMock<MockAutofillWebDataBackend> backend_; testing::NiceMock<MockAutofillWebDataBackend> backend_;
AutofillTable table_; AutofillTable table_;
WebDatabase db_; WebDatabase db_;

@@ -336,7 +336,7 @@ class AutofillWalletSyncBridgeTest : public UssSwitchToggler,
private: private:
autofill::TestAutofillClock test_clock_; autofill::TestAutofillClock test_clock_;
ScopedTempDir temp_dir_; ScopedTempDir temp_dir_;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
NiceMock<MockAutofillWebDataBackend> backend_; NiceMock<MockAutofillWebDataBackend> backend_;
AutofillTable table_; AutofillTable table_;
WebDatabase db_; WebDatabase db_;

@@ -91,8 +91,7 @@ class MockAutofillWebDataServiceObserver
class WebDataServiceTest : public testing::Test { class WebDataServiceTest : public testing::Test {
public: public:
WebDataServiceTest() WebDataServiceTest()
: scoped_task_environment_( : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {}
base::test::ScopedTaskEnvironment::MainThreadType::UI) {}
protected: protected:
void SetUp() override { void SetUp() override {
@@ -119,10 +118,10 @@ class WebDataServiceTest : public testing::Test {
wdbs_->ShutdownDatabase(); wdbs_->ShutdownDatabase();
wds_ = nullptr; wds_ = nullptr;
wdbs_ = nullptr; wdbs_ = nullptr;
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
} }
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
base::FilePath profile_dir_; base::FilePath profile_dir_;
scoped_refptr<AutofillWebDataService> wds_; scoped_refptr<AutofillWebDataService> wds_;
scoped_refptr<WebDatabaseService> wdbs_; scoped_refptr<WebDatabaseService> wdbs_;
@@ -207,7 +206,7 @@ TEST_F(WebDataServiceAutofillTest, FormFillAdd) {
static const int limit = 10; static const int limit = 10;
handle = wds_->GetFormValuesForElementName( handle = wds_->GetFormValuesForElementName(
name1_, base::string16(), limit, &consumer); name1_, base::string16(), limit, &consumer);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle, consumer.handle()); EXPECT_EQ(handle, consumer.handle());
ASSERT_EQ(1U, consumer.result().size()); ASSERT_EQ(1U, consumer.result().size());
EXPECT_EQ(value1_, consumer.result()[0].key().value()); EXPECT_EQ(value1_, consumer.result()[0].key().value());
@@ -284,7 +283,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileAdd) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>>
consumer; consumer;
WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer); WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle, consumer.handle()); EXPECT_EQ(handle, consumer.handle());
ASSERT_EQ(1U, consumer.result().size()); ASSERT_EQ(1U, consumer.result().size());
EXPECT_EQ(profile, *consumer.result()[0]); EXPECT_EQ(profile, *consumer.result()[0]);
@@ -303,7 +302,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileRemove) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>>
consumer; consumer;
WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer); WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle, consumer.handle()); EXPECT_EQ(handle, consumer.handle());
ASSERT_EQ(1U, consumer.result().size()); ASSERT_EQ(1U, consumer.result().size());
EXPECT_EQ(profile, *consumer.result()[0]); EXPECT_EQ(profile, *consumer.result()[0]);
@@ -322,7 +321,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileRemove) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>>
consumer2; consumer2;
WebDataServiceBase::Handle handle2 = wds_->GetAutofillProfiles(&consumer2); WebDataServiceBase::Handle handle2 = wds_->GetAutofillProfiles(&consumer2);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle2, consumer2.handle()); EXPECT_EQ(handle2, consumer2.handle());
ASSERT_EQ(0U, consumer2.result().size()); ASSERT_EQ(0U, consumer2.result().size());
} }
@@ -348,7 +347,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileUpdate) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>>
consumer; consumer;
WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer); WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle, consumer.handle()); EXPECT_EQ(handle, consumer.handle());
ASSERT_EQ(2U, consumer.result().size()); ASSERT_EQ(2U, consumer.result().size());
EXPECT_EQ(profile2, *consumer.result()[0]); EXPECT_EQ(profile2, *consumer.result()[0]);
@@ -370,7 +369,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileUpdate) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<AutofillProfile>>>
consumer2; consumer2;
WebDataServiceBase::Handle handle2 = wds_->GetAutofillProfiles(&consumer2); WebDataServiceBase::Handle handle2 = wds_->GetAutofillProfiles(&consumer2);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle2, consumer2.handle()); EXPECT_EQ(handle2, consumer2.handle());
ASSERT_EQ(2U, consumer2.result().size()); ASSERT_EQ(2U, consumer2.result().size());
EXPECT_EQ(profile2_changed, *consumer2.result()[0]); EXPECT_EQ(profile2_changed, *consumer2.result()[0]);
@@ -386,7 +385,7 @@ TEST_F(WebDataServiceAutofillTest, CreditAdd) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>>
consumer; consumer;
WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer); WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle, consumer.handle()); EXPECT_EQ(handle, consumer.handle());
ASSERT_EQ(1U, consumer.result().size()); ASSERT_EQ(1U, consumer.result().size());
EXPECT_EQ(card, *consumer.result()[0]); EXPECT_EQ(card, *consumer.result()[0]);
@@ -402,7 +401,7 @@ TEST_F(WebDataServiceAutofillTest, CreditCardRemove) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>>
consumer; consumer;
WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer); WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle, consumer.handle()); EXPECT_EQ(handle, consumer.handle());
ASSERT_EQ(1U, consumer.result().size()); ASSERT_EQ(1U, consumer.result().size());
EXPECT_EQ(credit_card, *consumer.result()[0]); EXPECT_EQ(credit_card, *consumer.result()[0]);
@@ -414,7 +413,7 @@ TEST_F(WebDataServiceAutofillTest, CreditCardRemove) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>>
consumer2; consumer2;
WebDataServiceBase::Handle handle2 = wds_->GetCreditCards(&consumer2); WebDataServiceBase::Handle handle2 = wds_->GetCreditCards(&consumer2);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle2, consumer2.handle()); EXPECT_EQ(handle2, consumer2.handle());
ASSERT_EQ(0U, consumer2.result().size()); ASSERT_EQ(0U, consumer2.result().size());
} }
@@ -432,7 +431,7 @@ TEST_F(WebDataServiceAutofillTest, CreditUpdate) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>>
consumer; consumer;
WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer); WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle, consumer.handle()); EXPECT_EQ(handle, consumer.handle());
ASSERT_EQ(2U, consumer.result().size()); ASSERT_EQ(2U, consumer.result().size());
EXPECT_EQ(card2, *consumer.result()[0]); EXPECT_EQ(card2, *consumer.result()[0]);
@@ -447,7 +446,7 @@ TEST_F(WebDataServiceAutofillTest, CreditUpdate) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>>
consumer2; consumer2;
WebDataServiceBase::Handle handle2 = wds_->GetCreditCards(&consumer2); WebDataServiceBase::Handle handle2 = wds_->GetCreditCards(&consumer2);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle2, consumer2.handle()); EXPECT_EQ(handle2, consumer2.handle());
ASSERT_EQ(2U, consumer2.result().size()); ASSERT_EQ(2U, consumer2.result().size());
EXPECT_NE(card2, *consumer2.result()[0]); EXPECT_NE(card2, *consumer2.result()[0]);
@@ -468,7 +467,7 @@ TEST_F(WebDataServiceAutofillTest, AutofillRemoveModifiedBetween) {
profile_consumer; profile_consumer;
WebDataServiceBase::Handle handle = WebDataServiceBase::Handle handle =
wds_->GetAutofillProfiles(&profile_consumer); wds_->GetAutofillProfiles(&profile_consumer);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle, profile_consumer.handle()); EXPECT_EQ(handle, profile_consumer.handle());
ASSERT_EQ(1U, profile_consumer.result().size()); ASSERT_EQ(1U, profile_consumer.result().size());
EXPECT_EQ(profile, *profile_consumer.result()[0]); EXPECT_EQ(profile, *profile_consumer.result()[0]);
@@ -481,7 +480,7 @@ TEST_F(WebDataServiceAutofillTest, AutofillRemoveModifiedBetween) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>>
card_consumer; card_consumer;
handle = wds_->GetCreditCards(&card_consumer); handle = wds_->GetCreditCards(&card_consumer);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle, card_consumer.handle()); EXPECT_EQ(handle, card_consumer.handle());
ASSERT_EQ(1U, card_consumer.result().size()); ASSERT_EQ(1U, card_consumer.result().size());
EXPECT_EQ(credit_card, *card_consumer.result()[0]); EXPECT_EQ(credit_card, *card_consumer.result()[0]);
@@ -501,7 +500,7 @@ TEST_F(WebDataServiceAutofillTest, AutofillRemoveModifiedBetween) {
profile_consumer2; profile_consumer2;
WebDataServiceBase::Handle handle2 = WebDataServiceBase::Handle handle2 =
wds_->GetAutofillProfiles(&profile_consumer2); wds_->GetAutofillProfiles(&profile_consumer2);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle2, profile_consumer2.handle()); EXPECT_EQ(handle2, profile_consumer2.handle());
ASSERT_EQ(0U, profile_consumer2.result().size()); ASSERT_EQ(0U, profile_consumer2.result().size());
@@ -509,7 +508,7 @@ TEST_F(WebDataServiceAutofillTest, AutofillRemoveModifiedBetween) {
AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>> AutofillWebDataServiceConsumer<std::vector<std::unique_ptr<CreditCard>>>
card_consumer2; card_consumer2;
handle2 = wds_->GetCreditCards(&card_consumer2); handle2 = wds_->GetCreditCards(&card_consumer2);
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_EQ(handle2, card_consumer2.handle()); EXPECT_EQ(handle2, card_consumer2.handle());
ASSERT_EQ(0U, card_consumer2.result().size()); ASSERT_EQ(0U, card_consumer2.result().size());
} }

@@ -254,7 +254,7 @@ class AutofillTypeTraitsTestImpl : public testing::Test,
} }
private: private:
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
mojo::BindingSet<TypeTraitsTest> bindings_; mojo::BindingSet<TypeTraitsTest> bindings_;
}; };

@@ -29,7 +29,7 @@ using ::testing::SizeIs;
class ConfigureBottomSheetActionTest : public testing::Test { class ConfigureBottomSheetActionTest : public testing::Test {
public: public:
ConfigureBottomSheetActionTest() ConfigureBottomSheetActionTest()
: task_env_(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} : task_env_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}
void SetUp() override { void SetUp() override {
ON_CALL(mock_action_delegate_, GetViewportMode()) ON_CALL(mock_action_delegate_, GetViewportMode())
@@ -84,7 +84,7 @@ class ConfigureBottomSheetActionTest : public testing::Test {
// task_env_ must be first to guarantee other field // task_env_ must be first to guarantee other field
// creation run in that environment. // creation run in that environment.
base::test::ScopedTaskEnvironment task_env_; base::test::TaskEnvironment task_env_;
MockActionDelegate mock_action_delegate_; MockActionDelegate mock_action_delegate_;
MockWebController mock_web_controller_; MockWebController mock_web_controller_;

@@ -33,7 +33,7 @@ using ::testing::UnorderedElementsAre;
class PromptActionTest : public testing::Test { class PromptActionTest : public testing::Test {
public: public:
PromptActionTest() PromptActionTest()
: task_env_(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} : task_env_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}
void SetUp() override { void SetUp() override {
ON_CALL(mock_web_controller_, OnElementCheck(_, _)) ON_CALL(mock_web_controller_, OnElementCheck(_, _))
@@ -56,7 +56,7 @@ class PromptActionTest : public testing::Test {
protected: protected:
// task_env_ must be first to guarantee other field // task_env_ must be first to guarantee other field
// creation run in that environment. // creation run in that environment.
base::test::ScopedTaskEnvironment task_env_; base::test::TaskEnvironment task_env_;
MockActionDelegate mock_action_delegate_; MockActionDelegate mock_action_delegate_;
MockWebController mock_web_controller_; MockWebController mock_web_controller_;

@@ -33,7 +33,7 @@ using ::testing::SizeIs;
class WaitForDocumentActionTest : public testing::Test { class WaitForDocumentActionTest : public testing::Test {
public: public:
WaitForDocumentActionTest() WaitForDocumentActionTest()
: task_env_(base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} : task_env_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}
void SetUp() override { void SetUp() override {
ON_CALL(mock_action_delegate_, OnWaitForDocumentReadyState(_, _, _)) ON_CALL(mock_action_delegate_, OnWaitForDocumentReadyState(_, _, _))
@@ -61,7 +61,7 @@ class WaitForDocumentActionTest : public testing::Test {
protected: protected:
// task_env_ must be first to guarantee other field // task_env_ must be first to guarantee other field
// creation run in that environment. // creation run in that environment.
base::test::ScopedTaskEnvironment task_env_; base::test::TaskEnvironment task_env_;
MockActionDelegate mock_action_delegate_; MockActionDelegate mock_action_delegate_;
WaitForDocumentProto proto_; WaitForDocumentProto proto_;

@@ -76,8 +76,8 @@ class ControllerTest : public content::RenderViewHostTestHarness {
public: public:
ControllerTest() ControllerTest()
: RenderViewHostTestHarness( : RenderViewHostTestHarness(
base::test::ScopedTaskEnvironment::MainThreadType::UI, base::test::TaskEnvironment::MainThreadType::UI,
base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {} base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}
~ControllerTest() override {} ~ControllerTest() override {}
void SetUp() override { void SetUp() override {

@@ -68,8 +68,7 @@ ACTION(DoNothing) {}
class ElementAreaTest : public testing::Test { class ElementAreaTest : public testing::Test {
protected: protected:
ElementAreaTest() ElementAreaTest()
: scoped_task_environment_( : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME),
base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME),
element_area_(&delegate_) { element_area_(&delegate_) {
delegate_.SetWebController(&mock_web_controller_); delegate_.SetWebController(&mock_web_controller_);
delegate_.GetMutableSettings()->element_position_update_interval = delegate_.GetMutableSettings()->element_position_update_interval =
@@ -104,9 +103,9 @@ class ElementAreaTest : public testing::Test {
reported_restricted_area_ = restricted_area; reported_restricted_area_ = restricted_area;
} }
// scoped_task_environment_ must be first to guarantee other field // task_environment_ must be first to guarantee other field
// creation run in that environment. // creation run in that environment.
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
MockWebController mock_web_controller_; MockWebController mock_web_controller_;
FakeScriptExecutorDelegate delegate_; FakeScriptExecutorDelegate delegate_;
@@ -382,8 +381,7 @@ TEST_F(ElementAreaTest, ElementMovesWithTime) {
EXPECT_THAT(reported_area_, ElementsAre(MatchingRectF(0, 25, 100, 50))); EXPECT_THAT(reported_area_, ElementsAre(MatchingRectF(0, 25, 100, 50)));
scoped_task_environment_.FastForwardBy( task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(100));
base::TimeDelta::FromMilliseconds(100));
// Updated area is available // Updated area is available
std::vector<RectF> rectangles; std::vector<RectF> rectangles;

@@ -23,11 +23,10 @@ namespace {
class RetryTimerTest : public testing::Test { class RetryTimerTest : public testing::Test {
protected: protected:
RetryTimerTest() RetryTimerTest()
: scoped_task_environment_( : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}
base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {}
void FastForwardOneSecond() { void FastForwardOneSecond() {
scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1));
} }
base::RepeatingCallback<void(base::OnceCallback<void(bool)>)> base::RepeatingCallback<void(base::OnceCallback<void(bool)>)>
@@ -65,9 +64,9 @@ class RetryTimerTest : public testing::Test {
captured_callback_ = std::move(callback); captured_callback_ = std::move(callback);
} }
// scoped_task_environment_ must be first to guarantee other field // task_environment_ must be first to guarantee other field
// creation run in that environment. // creation run in that environment.
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
int try_count_ = 0; int try_count_ = 0;
base::OnceCallback<void(bool)> captured_callback_; base::OnceCallback<void(bool)> captured_callback_;

@@ -76,8 +76,7 @@ class ScriptExecutorTest : public testing::Test,
protected: protected:
ScriptExecutorTest() ScriptExecutorTest()
: scoped_task_environment_( : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}
base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME) {}
// Implements ScriptExecutor::Listener // Implements ScriptExecutor::Listener
void OnServerPayloadChanged(const std::string& global_payload, void OnServerPayloadChanged(const std::string& global_payload,
@@ -145,9 +144,9 @@ class ScriptExecutorTest : public testing::Test,
interrupts_.emplace_back(std::move(interrupt)); interrupts_.emplace_back(std::move(interrupt));
} }
// scoped_task_environment_ must be first to guarantee other field // task_environment_ must be first to guarantee other field
// creation run in that environment. // creation run in that environment.
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
FakeScriptExecutorDelegate delegate_; FakeScriptExecutorDelegate delegate_;
Script script_; Script script_;
StrictMock<MockService> mock_service_; StrictMock<MockService> mock_service_;
@@ -364,14 +363,13 @@ TEST_F(ScriptExecutorTest, RunDelayedAction) {
// executor_callback_.Run() not expected to be run just yet, as the action is // executor_callback_.Run() not expected to be run just yet, as the action is
// delayed. // delayed.
executor_->Run(executor_callback_.Get()); executor_->Run(executor_callback_.Get());
EXPECT_TRUE(scoped_task_environment_.NextTaskIsDelayed()); EXPECT_TRUE(task_environment_.NextTaskIsDelayed());
// Moving forward in time triggers action execution. // Moving forward in time triggers action execution.
EXPECT_CALL(executor_callback_, EXPECT_CALL(executor_callback_,
Run(Field(&ScriptExecutor::Result::success, true))); Run(Field(&ScriptExecutor::Result::success, true)));
scoped_task_environment_.FastForwardBy( task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(1000));
base::TimeDelta::FromMilliseconds(1000)); EXPECT_EQ(task_environment_.GetPendingMainThreadTaskCount(), 0u);
EXPECT_EQ(scoped_task_environment_.GetPendingMainThreadTaskCount(), 0u);
} }
TEST_F(ScriptExecutorTest, ClearDetailsWhenFinished) { TEST_F(ScriptExecutorTest, ClearDetailsWhenFinished) {
@@ -533,7 +531,7 @@ TEST_F(ScriptExecutorTest, WaitForDomWaitUntil) {
OnElementCheck(Eq(Selector({"element"})), _)) OnElementCheck(Eq(Selector({"element"})), _))
.WillRepeatedly(RunOnceCallback<1>(true)); .WillRepeatedly(RunOnceCallback<1>(true));
EXPECT_CALL(executor_callback_, Run(_)); EXPECT_CALL(executor_callback_, Run(_));
scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1));
ASSERT_EQ(1u, processed_actions_capture.size()); ASSERT_EQ(1u, processed_actions_capture.size());
EXPECT_EQ(ACTION_APPLIED, processed_actions_capture[0].status()); EXPECT_EQ(ACTION_APPLIED, processed_actions_capture[0].status());
@@ -562,7 +560,7 @@ TEST_F(ScriptExecutorTest, WaitForDomWaitWhile) {
OnElementCheck(Eq(Selector({"element"})), _)) OnElementCheck(Eq(Selector({"element"})), _))
.WillRepeatedly(RunOnceCallback<1>(false)); .WillRepeatedly(RunOnceCallback<1>(false));
EXPECT_CALL(executor_callback_, Run(_)); EXPECT_CALL(executor_callback_, Run(_));
scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1));
ASSERT_EQ(1u, processed_actions_capture.size()); ASSERT_EQ(1u, processed_actions_capture.size());
EXPECT_EQ(ACTION_APPLIED, processed_actions_capture[0].status()); EXPECT_EQ(ACTION_APPLIED, processed_actions_capture[0].status());
@@ -1012,7 +1010,7 @@ TEST_F(ScriptExecutorTest, PauseWaitForDomWhileNavigating) {
// timeout. // timeout.
delegate_.UpdateNavigationState(/* navigating= */ true, /* error= */ false); delegate_.UpdateNavigationState(/* navigating= */ true, /* error= */ false);
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1));
} }
// The end of navigation un-pauses WaitForDom. // The end of navigation un-pauses WaitForDom.
@@ -1166,7 +1164,7 @@ TEST_F(ScriptExecutorTest, ReportNavigationEnd) {
EXPECT_CALL(mock_web_controller_, EXPECT_CALL(mock_web_controller_,
OnElementCheck(Eq(Selector({"element"})), _)) OnElementCheck(Eq(Selector({"element"})), _))
.WillOnce(RunOnceCallback<1>(true)); .WillOnce(RunOnceCallback<1>(true));
scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1)); task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1));
ASSERT_THAT(processed_actions_capture, SizeIs(1)); ASSERT_THAT(processed_actions_capture, SizeIs(1));
EXPECT_EQ(ACTION_APPLIED, processed_actions_capture[0].status()); EXPECT_EQ(ACTION_APPLIED, processed_actions_capture[0].status());

@@ -271,7 +271,7 @@ class OptOutBlacklistTest : public testing::Test {
} }
protected: protected:
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
// Observer to |black_list_|. // Observer to |black_list_|.
TestOptOutBlacklistDelegate blacklist_delegate_; TestOptOutBlacklistDelegate blacklist_delegate_;

@@ -93,7 +93,7 @@ class OptOutStoreSQLTest : public testing::Test {
void TearDown() override { DestroyStore(); } void TearDown() override { DestroyStore(); }
protected: protected:
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
// The backing SQL store. // The backing SQL store.
std::unique_ptr<OptOutStoreSQL> store_; std::unique_ptr<OptOutStoreSQL> store_;

@@ -32,7 +32,7 @@ class BookmarkExpandedStateTrackerTest : public testing::Test {
void SetUp() override; void SetUp() override;
void TearDown() override; void TearDown() override;
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
TestingPrefServiceSimple prefs_; TestingPrefServiceSimple prefs_;
std::unique_ptr<BookmarkModel> model_; std::unique_ptr<BookmarkModel> model_;

@@ -1231,7 +1231,7 @@ TEST(BookmarkModelLoadTest, TitledUrlIndexPopulatedOnLoad) {
// Create a model with a single url. // Create a model with a single url.
base::ScopedTempDir tmp_dir; base::ScopedTempDir tmp_dir;
ASSERT_TRUE(tmp_dir.CreateUniqueTempDir()); ASSERT_TRUE(tmp_dir.CreateUniqueTempDir());
base::test::ScopedTaskEnvironment scoped_task_environment; base::test::TaskEnvironment task_environment;
std::unique_ptr<BookmarkModel> model = std::unique_ptr<BookmarkModel> model =
std::make_unique<BookmarkModel>(std::make_unique<TestBookmarkClient>()); std::make_unique<BookmarkModel>(std::make_unique<TestBookmarkClient>());
model->Load(nullptr, tmp_dir.GetPath(), base::ThreadTaskRunnerHandle::Get(), model->Load(nullptr, tmp_dir.GetPath(), base::ThreadTaskRunnerHandle::Get(),

@@ -27,8 +27,7 @@ namespace bookmarks {
class BookmarkNodeDataTest : public testing::Test { class BookmarkNodeDataTest : public testing::Test {
public: public:
BookmarkNodeDataTest() BookmarkNodeDataTest()
: scoped_task_environment_( : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {}
base::test::ScopedTaskEnvironment::MainThreadType::UI) {}
void SetUp() override { void SetUp() override {
model_ = TestBookmarkClient::CreateModel(); model_ = TestBookmarkClient::CreateModel();
@@ -56,7 +55,7 @@ class BookmarkNodeDataTest : public testing::Test {
private: private:
base::ScopedTempDir profile_dir_; base::ScopedTempDir profile_dir_;
std::unique_ptr<BookmarkModel> model_; std::unique_ptr<BookmarkModel> model_;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
DISALLOW_COPY_AND_ASSIGN(BookmarkNodeDataTest); DISALLOW_COPY_AND_ASSIGN(BookmarkNodeDataTest);
}; };

@@ -32,8 +32,7 @@ class BookmarkUtilsTest : public testing::Test,
public BaseBookmarkModelObserver { public BaseBookmarkModelObserver {
public: public:
BookmarkUtilsTest() BookmarkUtilsTest()
: scoped_task_environment_( : task_environment_(base::test::TaskEnvironment::MainThreadType::UI),
base::test::ScopedTaskEnvironment::MainThreadType::UI),
grouped_changes_beginning_count_(0), grouped_changes_beginning_count_(0),
grouped_changes_ended_count_(0) {} grouped_changes_ended_count_(0) {}
@@ -74,7 +73,7 @@ class BookmarkUtilsTest : public testing::Test,
} }
// Clipboard requires a message loop. // Clipboard requires a message loop.
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
int grouped_changes_beginning_count_; int grouped_changes_beginning_count_;
int grouped_changes_ended_count_; int grouped_changes_ended_count_;

@@ -165,7 +165,7 @@ class ManagedBookmarksTrackerTest : public testing::Test {
} }
base::ScopedTempDir scoped_temp_dir_; base::ScopedTempDir scoped_temp_dir_;
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
TestingPrefServiceSimple prefs_; TestingPrefServiceSimple prefs_;
std::unique_ptr<BookmarkModel> model_; std::unique_ptr<BookmarkModel> model_;
MockBookmarkModelObserver observer_; MockBookmarkModelObserver observer_;

@@ -65,7 +65,7 @@ class WatcherMetricsProviderWinTest : public testing::Test {
} }
protected: protected:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
registry_util::RegistryOverrideManager override_manager_; registry_util::RegistryOverrideManager override_manager_;
base::HistogramTester histogram_tester_; base::HistogramTester histogram_tester_;
}; };
@@ -138,7 +138,7 @@ TEST_F(WatcherMetricsProviderWinTest, DeletesExitcodeKeyWhenNotReporting) {
provider.OnRecordingDisabled(); provider.OnRecordingDisabled();
// Flush the task(s). // Flush the task(s).
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
// Make sure the subkey for the pseudo process has been deleted on reporting. // Make sure the subkey for the pseudo process has been deleted on reporting.
ASSERT_EQ(ERROR_FILE_NOT_FOUND, ASSERT_EQ(ERROR_FILE_NOT_FOUND,

@@ -50,7 +50,7 @@ class BrowsingDataUtilsTest : public testing::Test {
PrefService* prefs() { return &prefs_; } PrefService* prefs() { return &prefs_; }
private: private:
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
sync_preferences::TestingPrefServiceSyncable prefs_; sync_preferences::TestingPrefServiceSyncable prefs_;
}; };

@@ -104,7 +104,7 @@ class BrowsingDataCounterTest : public testing::Test {
private: private:
std::unique_ptr<TestingPrefServiceSimple> pref_service_; std::unique_ptr<TestingPrefServiceSimple> pref_service_;
std::unique_ptr<MockBrowsingDataCounter> counter_; std::unique_ptr<MockBrowsingDataCounter> counter_;
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
}; };
TEST_F(BrowsingDataCounterTest, NoResponse) { TEST_F(BrowsingDataCounterTest, NoResponse) {

@@ -60,7 +60,7 @@ class HistoryNoticeUtilsTest : public ::testing::Test {
std::unique_ptr<syncer::TestSyncService> sync_service_; std::unique_ptr<syncer::TestSyncService> sync_service_;
std::unique_ptr<history::FakeWebHistoryService> history_service_; std::unique_ptr<history::FakeWebHistoryService> history_service_;
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
}; };
TEST_F(HistoryNoticeUtilsTest, NotSyncing) { TEST_F(HistoryNoticeUtilsTest, NotSyncing) {

@@ -114,7 +114,7 @@ class CaptivePortalDetectorTest : public testing::Test,
} }
private: private:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
std::unique_ptr<CaptivePortalDetector> detector_; std::unique_ptr<CaptivePortalDetector> detector_;
}; };

@@ -73,8 +73,7 @@ MATCHER_P(HasPayloadUtf8, payload, "") {
class CastMessageHandlerTest : public testing::Test { class CastMessageHandlerTest : public testing::Test {
public: public:
CastMessageHandlerTest() CastMessageHandlerTest()
: thread_bundle_( : thread_bundle_(base::test::TaskEnvironment::TimeSource::MOCK_TIME),
base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME),
cast_socket_service_(new base::TestSimpleTaskRunner()), cast_socket_service_(new base::TestSimpleTaskRunner()),
handler_(&cast_socket_service_, handler_(&cast_socket_service_,
/* connector */ nullptr, /* connector */ nullptr,

@@ -166,7 +166,7 @@ class CastTransportTest : public testing::Test {
run_loop.RunUntilIdle(); run_loop.RunUntilIdle();
} }
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
MockCastTransportDelegate* delegate_; MockCastTransportDelegate* delegate_;
MockSocket mock_socket_; MockSocket mock_socket_;
Logger* logger_; Logger* logger_;

@@ -98,7 +98,7 @@ class KeepAliveDelegateTest : public testing::Test {
run_loop.RunUntilIdle(); run_loop.RunUntilIdle();
} }
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
MockCastSocket socket_; MockCastSocket socket_;
std::unique_ptr<KeepAliveDelegate> keep_alive_; std::unique_ptr<KeepAliveDelegate> keep_alive_;
scoped_refptr<Logger> logger_; scoped_refptr<Logger> logger_;

@@ -39,8 +39,8 @@ class ChromeRequireCTDelegateTest : public ::testing::Test {
} }
protected: protected:
base::test::ScopedTaskEnvironment task_environment_{ base::test::TaskEnvironment task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::IO}; base::test::TaskEnvironment::MainThreadType::IO};
scoped_refptr<net::X509Certificate> cert_; scoped_refptr<net::X509Certificate> cert_;
net::HashValueVector hashes_; net::HashValueVector hashes_;
}; };

@@ -160,7 +160,7 @@ class JpegEncodeAcceleratorTestEnvironment : public ::testing::Environment {
}; };
void JpegEncodeAcceleratorTestEnvironment::SetUp() { void JpegEncodeAcceleratorTestEnvironment::SetUp() {
// Since base::test::ScopedTaskEnvironment will call // Since base::test::TaskEnvironment will call
// TestTimeouts::action_max_timeout(), TestTimeouts::Initialize() needs to be // TestTimeouts::action_max_timeout(), TestTimeouts::Initialize() needs to be
// called in advance. // called in advance.
TestTimeouts::Initialize(); TestTimeouts::Initialize();
@@ -680,7 +680,7 @@ class JpegEncodeAcceleratorTest : public ::testing::Test {
// This is needed to allow the usage of methods in post_task.h in // This is needed to allow the usage of methods in post_task.h in
// JpegEncodeAccelerator implementations. // JpegEncodeAccelerator implementations.
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
// The elements of |test_aligned_images_| and |test_images_| are // The elements of |test_aligned_images_| and |test_images_| are
// owned by JpegEncodeAcceleratorTestEnvironment. // owned by JpegEncodeAcceleratorTestEnvironment.

@@ -46,7 +46,7 @@ class MojoMjpegDecodeAcceleratorServiceTest : public ::testing::Test {
private: private:
// This is required to allow base::ThreadTaskRunnerHandle::Get() from the // This is required to allow base::ThreadTaskRunnerHandle::Get() from the
// test execution thread. // test execution thread.
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
}; };
TEST_F(MojoMjpegDecodeAcceleratorServiceTest, InitializeAndDecode) { TEST_F(MojoMjpegDecodeAcceleratorServiceTest, InitializeAndDecode) {

@@ -200,7 +200,7 @@ class ComponentInstallerTest : public testing::Test {
void Unpack(const base::FilePath& crx_path); void Unpack(const base::FilePath& crx_path);
ComponentUnpacker::Result result() const { return result_; } ComponentUnpacker::Result result() const { return result_; }
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
private: private:
void UnpackComplete(const ComponentUnpacker::Result& result); void UnpackComplete(const ComponentUnpacker::Result& result);
@@ -357,7 +357,7 @@ TEST_F(ComponentInstallerTest, UnpackPathInstallSuccess) {
EXPECT_EQ(0, result.error); EXPECT_EQ(0, result.error);
})); }));
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_FALSE(base::PathExists(unpack_path)); EXPECT_FALSE(base::PathExists(unpack_path));
EXPECT_CALL(update_client(), Stop()).Times(1); EXPECT_CALL(update_client(), Stop()).Times(1);
@@ -388,7 +388,7 @@ TEST_F(ComponentInstallerTest, UnpackPathInstallError) {
result.error); result.error);
})); }));
scoped_task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
EXPECT_FALSE(base::PathExists(unpack_path)); EXPECT_FALSE(base::PathExists(unpack_path));
EXPECT_CALL(update_client(), Stop()).Times(1); EXPECT_CALL(update_client(), Stop()).Times(1);

@@ -165,7 +165,7 @@ class ComponentUpdaterTest : public testing::Test {
const UpdateScheduler::UserTask& user_task, const UpdateScheduler::UserTask& user_task,
const UpdateScheduler::OnStopTaskCallback& on_stop); const UpdateScheduler::OnStopTaskCallback& on_stop);
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
base::RunLoop runloop_; base::RunLoop runloop_;
scoped_refptr<TestConfigurator> config_ = scoped_refptr<TestConfigurator> config_ =
@@ -257,7 +257,7 @@ void ComponentUpdaterTest::RunThreads() {
void ComponentUpdaterTest::RunUpdateTask( void ComponentUpdaterTest::RunUpdateTask(
const UpdateScheduler::UserTask& user_task) { const UpdateScheduler::UserTask& user_task) {
scoped_task_environment_.GetMainThreadTaskRunner()->PostTask( task_environment_.GetMainThreadTaskRunner()->PostTask(
FROM_HERE, base::BindRepeating( FROM_HERE, base::BindRepeating(
[](const UpdateScheduler::UserTask& user_task, [](const UpdateScheduler::UserTask& user_task,
ComponentUpdaterTest* test) { ComponentUpdaterTest* test) {

@@ -19,12 +19,11 @@ namespace component_updater {
class ComponentUpdaterTimerTest : public testing::Test { class ComponentUpdaterTimerTest : public testing::Test {
public: public:
ComponentUpdaterTimerTest() ComponentUpdaterTimerTest()
: scoped_task_environment_( : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {}
base::test::ScopedTaskEnvironment::MainThreadType::UI) {}
~ComponentUpdaterTimerTest() override {} ~ComponentUpdaterTimerTest() override {}
private: private:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
}; };
TEST_F(ComponentUpdaterTimerTest, Start) { TEST_F(ComponentUpdaterTimerTest, Start) {

@@ -164,7 +164,7 @@ class ConsentSyncBridgeImplTest : public testing::Test {
} }
private: private:
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
testing::NiceMock<MockModelTypeChangeProcessor> mock_processor_; testing::NiceMock<MockModelTypeChangeProcessor> mock_processor_;
std::unique_ptr<ConsentSyncBridgeImpl> bridge_; std::unique_ptr<ConsentSyncBridgeImpl> bridge_;
}; };

@@ -32,7 +32,7 @@ class ContentCaptureStructTraitsTest : public testing::Test,
std::move(callback).Run(i); std::move(callback).Run(i);
} }
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
mojo::BindingSet<TraitsTestService> traits_test_bindings_; mojo::BindingSet<TraitsTestService> traits_test_bindings_;
DISALLOW_COPY_AND_ASSIGN(ContentCaptureStructTraitsTest); DISALLOW_COPY_AND_ASSIGN(ContentCaptureStructTraitsTest);

@@ -93,7 +93,7 @@ class CookieSettingsTest : public testing::Test {
// There must be a valid ThreadTaskRunnerHandle in HostContentSettingsMap's // There must be a valid ThreadTaskRunnerHandle in HostContentSettingsMap's
// scope. // scope.
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
sync_preferences::TestingPrefServiceSyncable prefs_; sync_preferences::TestingPrefServiceSyncable prefs_;
scoped_refptr<HostContentSettingsMap> settings_map_; scoped_refptr<HostContentSettingsMap> settings_map_;

@@ -45,8 +45,7 @@ class CrashMetricsReporterObserver : public CrashMetricsReporter::Observer {
class CrashMetricsReporterTest : public testing::Test { class CrashMetricsReporterTest : public testing::Test {
public: public:
CrashMetricsReporterTest() CrashMetricsReporterTest()
: scoped_environment_( : scoped_environment_(base::test::TaskEnvironment::MainThreadType::UI) {}
base::test::ScopedTaskEnvironment::MainThreadType::UI) {}
~CrashMetricsReporterTest() override {} ~CrashMetricsReporterTest() override {}
protected: protected:
@@ -82,7 +81,7 @@ class CrashMetricsReporterTest : public testing::Test {
} }
private: private:
base::test::ScopedTaskEnvironment scoped_environment_; base::test::TaskEnvironment scoped_environment_;
DISALLOW_COPY_AND_ASSIGN(CrashMetricsReporterTest); DISALLOW_COPY_AND_ASSIGN(CrashMetricsReporterTest);
}; };

@@ -80,7 +80,7 @@ class HostCachePersistenceManagerTest : public testing::Test {
static const char kPrefName[]; static const char kPrefName[];
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
base::ScopedMockTimeMessageLoopTaskRunner task_runner_; base::ScopedMockTimeMessageLoopTaskRunner task_runner_;
// The HostCache and PrefService have to outlive the // The HostCache and PrefService have to outlive the

@@ -43,7 +43,7 @@ class RunnablesTest : public ::testing::Test {
bool callback_called() const { return callback_called_; } bool callback_called() const { return callback_called_; }
// Provide a message loop for use by TestExecutor instances. // Provide a message loop for use by TestExecutor instances.
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
private: private:
bool callback_called_ = false; bool callback_called_ = false;

@@ -27,8 +27,8 @@ class BufferTest : public ::testing::Test {
// Provide a task environment for use by TestExecutor instances. Do not // Provide a task environment for use by TestExecutor instances. Do not
// initialize the ThreadPool as this is done by the Cronet_Engine // initialize the ThreadPool as this is done by the Cronet_Engine
base::test::ScopedTaskEnvironment scoped_task_environment_{ base::test::TaskEnvironment task_environment_{
base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY};
private: private:
void set_on_destroy_called(bool value) { on_destroy_called_ = value; } void set_on_destroy_called(bool value) { on_destroy_called_ = value; }

@@ -24,8 +24,8 @@ class ExecutorsTest : public ::testing::Test {
// Provide a task environment for use by TestExecutor instances. Do not // Provide a task environment for use by TestExecutor instances. Do not
// initialize the ThreadPool as this is done by the Cronet_Engine // initialize the ThreadPool as this is done by the Cronet_Engine
base::test::ScopedTaskEnvironment scoped_task_environment_{ base::test::TaskEnvironment task_environment_{
base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY};
private: private:
void set_runnable_called(bool value) { runnable_called_ = value; } void set_runnable_called(bool value) { runnable_called_ = value; }

@@ -486,8 +486,8 @@ class UrlRequestTest : public ::testing::TestWithParam<
protected: protected:
// Provide a task environment for use by TestExecutor instances. Do not // Provide a task environment for use by TestExecutor instances. Do not
// initialize the ThreadPool as this is done by the Cronet_Engine // initialize the ThreadPool as this is done by the Cronet_Engine
base::test::ScopedTaskEnvironment scoped_task_environment_{ base::test::TaskEnvironment task_environment_{
base::test::ScopedTaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY}; base::test::TaskEnvironment::ThreadingMode::MAIN_THREAD_ONLY};
// Not owned, |request_finished_listener_| destroys itself when run. This // Not owned, |request_finished_listener_| destroys itself when run. This
// pointer is only needed to unregister the listener from the Engine in // pointer is only needed to unregister the listener from the Engine in

@@ -131,8 +131,7 @@ class MockHostResolverProc : public net::HostResolverProc {
class StaleHostResolverTest : public testing::Test { class StaleHostResolverTest : public testing::Test {
protected: protected:
StaleHostResolverTest() StaleHostResolverTest()
: scoped_task_environment_( : task_environment_(base::test::TaskEnvironment::MainThreadType::IO),
base::test::ScopedTaskEnvironment::MainThreadType::IO),
mock_network_change_notifier_( mock_network_change_notifier_(
net::test::MockNetworkChangeNotifier::Create()), net::test::MockNetworkChangeNotifier::Create()),
mock_proc_(new MockHostResolverProc(net::OK)), mock_proc_(new MockHostResolverProc(net::OK)),
@@ -339,7 +338,7 @@ class StaleHostResolverTest : public testing::Test {
private: private:
// Needed for HostResolver to run HostResolverProc callbacks. // Needed for HostResolver to run HostResolverProc callbacks.
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
base::SimpleTestTickClock tick_clock_; base::SimpleTestTickClock tick_clock_;
std::unique_ptr<net::test::MockNetworkChangeNotifier> std::unique_ptr<net::test::MockNetworkChangeNotifier>
mock_network_change_notifier_; mock_network_change_notifier_;

@@ -57,8 +57,8 @@ bool JsonHeaderEquals(base::StringPiece expected, base::StringPiece actual) {
} // namespace } // namespace
TEST(URLRequestContextConfigTest, TestExperimentalOptionParsing) { TEST(URLRequestContextConfigTest, TestExperimentalOptionParsing) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
// Create JSON for experimental options. // Create JSON for experimental options.
base::DictionaryValue options; base::DictionaryValue options;
@@ -290,8 +290,8 @@ TEST(URLRequestContextConfigTest, TestExperimentalOptionParsing) {
} }
TEST(URLRequestContextConfigTest, SetSupportedQuicVersion) { TEST(URLRequestContextConfigTest, SetSupportedQuicVersion) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.
@@ -343,8 +343,8 @@ TEST(URLRequestContextConfigTest, SetSupportedQuicVersion) {
} }
TEST(URLRequestContextConfigTest, SetUnsupportedQuicVersion) { TEST(URLRequestContextConfigTest, SetUnsupportedQuicVersion) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.
@@ -396,8 +396,8 @@ TEST(URLRequestContextConfigTest, SetUnsupportedQuicVersion) {
} }
TEST(URLRequestContextConfigTest, SetQuicServerMigrationOptions) { TEST(URLRequestContextConfigTest, SetQuicServerMigrationOptions) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.
@@ -457,8 +457,8 @@ TEST(URLRequestContextConfigTest, SetQuicServerMigrationOptions) {
#endif #endif
TEST(URLRequestContextConfigTest, TEST(URLRequestContextConfigTest,
MAYBE_SetQuicGoAwaySessionsOnIPChangeByDefault) { MAYBE_SetQuicGoAwaySessionsOnIPChangeByDefault) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.
@@ -519,8 +519,8 @@ TEST(URLRequestContextConfigTest,
#endif #endif
TEST(URLRequestContextConfigTest, TEST(URLRequestContextConfigTest,
MAYBE_SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions) { MAYBE_SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.
@@ -581,8 +581,8 @@ TEST(URLRequestContextConfigTest,
#endif #endif
TEST(URLRequestContextConfigTest, TEST(URLRequestContextConfigTest,
MAYBE_DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions) { MAYBE_DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.
@@ -633,8 +633,8 @@ TEST(URLRequestContextConfigTest,
} }
TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationV2Options) { TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationV2Options) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.
@@ -707,8 +707,8 @@ TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationV2Options) {
} }
TEST(URLRequestContextConfigTest, SetQuicStaleDNSracing) { TEST(URLRequestContextConfigTest, SetQuicStaleDNSracing) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.
@@ -758,8 +758,8 @@ TEST(URLRequestContextConfigTest, SetQuicStaleDNSracing) {
} }
TEST(URLRequestContextConfigTest, SetQuicHostWhitelist) { TEST(URLRequestContextConfigTest, SetQuicHostWhitelist) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.
@@ -810,8 +810,8 @@ TEST(URLRequestContextConfigTest, SetQuicHostWhitelist) {
} }
TEST(URLRequestContextConfigTest, SetQuicMaxTimeBeforeCryptoHandshake) { TEST(URLRequestContextConfigTest, SetQuicMaxTimeBeforeCryptoHandshake) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.
@@ -866,8 +866,8 @@ TEST(URLRequestContextConfigTest, SetQuicMaxTimeBeforeCryptoHandshake) {
} }
TEST(URLURLRequestContextConfigTest, SetQuicConnectionOptions) { TEST(URLURLRequestContextConfigTest, SetQuicConnectionOptions) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.
@@ -928,8 +928,8 @@ TEST(URLURLRequestContextConfigTest, SetQuicConnectionOptions) {
} }
TEST(URLURLRequestContextConfigTest, SetAcceptLanguageAndUserAgent) { TEST(URLURLRequestContextConfigTest, SetAcceptLanguageAndUserAgent) {
base::test::ScopedTaskEnvironment scoped_task_environment_( base::test::TaskEnvironment task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
URLRequestContextConfig config( URLRequestContextConfig config(
// Enable QUIC. // Enable QUIC.

@@ -106,10 +106,9 @@ class TestDataReductionProxyPingbackClientImpl
class DataReductionProxyPingbackClientImplTest : public testing::Test { class DataReductionProxyPingbackClientImplTest : public testing::Test {
public: public:
DataReductionProxyPingbackClientImplTest() DataReductionProxyPingbackClientImplTest()
: scoped_task_environment_( : task_environment_(
base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME, base::test::TaskEnvironment::TimeSource::MOCK_TIME,
base::test::ScopedTaskEnvironment::ThreadPoolExecutionMode::ASYNC) { base::test::TaskEnvironment::ThreadPoolExecutionMode::ASYNC) {}
}
TestDataReductionProxyPingbackClientImpl* pingback_client() const { TestDataReductionProxyPingbackClientImpl* pingback_client() const {
return pingback_client_.get(); return pingback_client_.get();
@@ -233,7 +232,7 @@ class DataReductionProxyPingbackClientImplTest : public testing::Test {
int num_network_requests() { return num_network_requests_; } int num_network_requests() { return num_network_requests_; }
protected: protected:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
private: private:
network::TestURLLoaderFactory test_url_loader_factory_; network::TestURLLoaderFactory test_url_loader_factory_;
@@ -760,7 +759,7 @@ TEST_F(DataReductionProxyPingbackClientImplTest,
false /* black_listed */); false /* black_listed */);
// Don't report the crash dump details. // Don't report the crash dump details.
scoped_task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(5)); task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(5));
EXPECT_EQ(upload_content_type(), "application/x-protobuf"); EXPECT_EQ(upload_content_type(), "application/x-protobuf");
RecordPageloadMetricsRequest batched_request; RecordPageloadMetricsRequest batched_request;

@@ -139,7 +139,7 @@ class DataReductionProxyURLLoaderThrottleTest : public ::testing::Test {
} }
private: private:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
MockMojoDataReductionProxy mock_mojo_data_reduction_proxy_; MockMojoDataReductionProxy mock_mojo_data_reduction_proxy_;
}; };

@@ -114,8 +114,7 @@ const char kLastUpdateTime[] = "Wed, 18 Sep 2013 03:45:26";
class DataReductionProxyCompressionStatsTest : public testing::Test { class DataReductionProxyCompressionStatsTest : public testing::Test {
protected: protected:
DataReductionProxyCompressionStatsTest() DataReductionProxyCompressionStatsTest()
: scoped_task_environment_( : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {
base::test::ScopedTaskEnvironment::MainThreadType::UI) {
EXPECT_TRUE(base::Time::FromString(kLastUpdateTime, &now_)); EXPECT_TRUE(base::Time::FromString(kLastUpdateTime, &now_));
} }
@@ -500,7 +499,7 @@ class DataReductionProxyCompressionStatsTest : public testing::Test {
} }
private: private:
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
std::unique_ptr<DataReductionProxyTestContext> drp_test_context_; std::unique_ptr<DataReductionProxyTestContext> drp_test_context_;
std::unique_ptr<DataReductionProxyCompressionStats> compression_stats_; std::unique_ptr<DataReductionProxyCompressionStats> compression_stats_;
base::Time now_; base::Time now_;

@@ -400,7 +400,7 @@ class DataReductionProxyConfigServiceClientTest : public testing::Test {
private: private:
base::test::ScopedFeatureList scoped_feature_list_; base::test::ScopedFeatureList scoped_feature_list_;
base::test::ScopedTaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
network::TestURLLoaderFactory test_url_loader_factory_; network::TestURLLoaderFactory test_url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> scoped_refptr<network::SharedURLLoaderFactory>

@@ -201,7 +201,7 @@ class DataReductionProxyConfigTest : public testing::Test {
} }
content::TestBrowserThreadBundle task_environment_{ content::TestBrowserThreadBundle task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::IO}; base::test::TaskEnvironment::MainThreadType::IO};
std::unique_ptr<DataReductionProxyTestContext> test_context_; std::unique_ptr<DataReductionProxyTestContext> test_context_;

@@ -101,7 +101,7 @@ class DataReductionProxyConfiguratorTest : public testing::Test {
} }
TestingPrefServiceSimple test_prefs; TestingPrefServiceSimple test_prefs;
base::test::ScopedTaskEnvironment scoped_task_environment_; base::test::TaskEnvironment task_environment_;
std::unique_ptr<DataReductionProxyTestContext> test_context_; std::unique_ptr<DataReductionProxyTestContext> test_context_;
std::unique_ptr<DataReductionProxyConfigurator> config_; std::unique_ptr<DataReductionProxyConfigurator> config_;
std::unique_ptr<NetworkPropertiesManager> manager_; std::unique_ptr<NetworkPropertiesManager> manager_;

@@ -26,8 +26,8 @@ class DataReductionProxyDataTest : public testing::Test {
DataReductionProxyDataTest() {} DataReductionProxyDataTest() {}
private: private:
base::test::ScopedTaskEnvironment task_environment_{ base::test::TaskEnvironment task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::IO}; base::test::TaskEnvironment::MainThreadType::IO};
}; };
TEST_F(DataReductionProxyDataTest, BasicSettersAndGetters) { TEST_F(DataReductionProxyDataTest, BasicSettersAndGetters) {

@@ -173,8 +173,8 @@ class DataReductionProxyRequestOptionsTest : public testing::Test {
EXPECT_EQ(expected_header, header_value); EXPECT_EQ(expected_header, header_value);
} }
base::test::ScopedTaskEnvironment task_environment_{ base::test::TaskEnvironment task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::IO}; base::test::TaskEnvironment::MainThreadType::IO};
std::unique_ptr<TestDataReductionProxyRequestOptions> request_options_; std::unique_ptr<TestDataReductionProxyRequestOptions> request_options_;
std::unique_ptr<DataReductionProxyTestContext> test_context_; std::unique_ptr<DataReductionProxyTestContext> test_context_;
net::HttpRequestHeaders callback_headers_; net::HttpRequestHeaders callback_headers_;

@@ -72,7 +72,7 @@ class DataReductionProxyServiceTest : public testing::Test {
PrefService* prefs() { return &prefs_; } PrefService* prefs() { return &prefs_; }
protected: protected:
content::TestBrowserThreadBundle scoped_task_environment_; content::TestBrowserThreadBundle task_environment_;
private: private:
TestingPrefServiceSimple prefs_; TestingPrefServiceSimple prefs_;

@@ -129,8 +129,8 @@ TEST(DataReductionProxySettingsStandaloneTest, TestEndToEndSecureProxyCheck) {
data_reduction_proxy::switches::kDataReductionProxyHttpProxies, data_reduction_proxy::switches::kDataReductionProxyHttpProxies,
kHttpsProxy.ToURI() + ";" + kHttpProxy.ToURI()); kHttpsProxy.ToURI() + ";" + kHttpProxy.ToURI());
base::test::ScopedTaskEnvironment task_environment{ base::test::TaskEnvironment task_environment{
base::test::ScopedTaskEnvironment::MainThreadType::IO}; base::test::TaskEnvironment::MainThreadType::IO};
struct TestCase { struct TestCase {
const char* response_headers; const char* response_headers;
const char* response_body; const char* response_body;
@@ -200,8 +200,8 @@ TEST(DataReductionProxySettingsStandaloneTest, TestEndToEndSecureProxyCheck) {
} }
TEST(DataReductionProxySettingsStandaloneTest, TestOnProxyEnabledPrefChange) { TEST(DataReductionProxySettingsStandaloneTest, TestOnProxyEnabledPrefChange) {
base::test::ScopedTaskEnvironment task_environment{ base::test::TaskEnvironment task_environment{
base::test::ScopedTaskEnvironment::MainThreadType::IO}; base::test::TaskEnvironment::MainThreadType::IO};
std::unique_ptr<DataReductionProxyTestContext> drp_test_context = std::unique_ptr<DataReductionProxyTestContext> drp_test_context =
DataReductionProxyTestContext::Builder() DataReductionProxyTestContext::Builder()
.WithMockConfig() .WithMockConfig()
@@ -232,8 +232,8 @@ TEST(DataReductionProxySettingsStandaloneTest, TestOnProxyEnabledPrefChange) {
} }
TEST(DataReductionProxySettingsStandaloneTest, TestIsProxyEnabledOrManaged) { TEST(DataReductionProxySettingsStandaloneTest, TestIsProxyEnabledOrManaged) {
base::test::ScopedTaskEnvironment task_environment{ base::test::TaskEnvironment task_environment{
base::test::ScopedTaskEnvironment::MainThreadType::IO}; base::test::TaskEnvironment::MainThreadType::IO};
std::unique_ptr<DataReductionProxyTestContext> drp_test_context = std::unique_ptr<DataReductionProxyTestContext> drp_test_context =
DataReductionProxyTestContext::Builder() DataReductionProxyTestContext::Builder()
.WithMockConfig() .WithMockConfig()
@@ -273,8 +273,8 @@ TEST(DataReductionProxySettingsStandaloneTest, TestIsProxyEnabledOrManaged) {
} }
TEST(DataReductionProxySettingsStandaloneTest, TestCanUseDataReductionProxy) { TEST(DataReductionProxySettingsStandaloneTest, TestCanUseDataReductionProxy) {
base::test::ScopedTaskEnvironment task_environment{ base::test::TaskEnvironment task_environment{
base::test::ScopedTaskEnvironment::MainThreadType::IO}; base::test::TaskEnvironment::MainThreadType::IO};
std::unique_ptr<DataReductionProxyTestContext> drp_test_context = std::unique_ptr<DataReductionProxyTestContext> drp_test_context =
DataReductionProxyTestContext::Builder() DataReductionProxyTestContext::Builder()
.WithMockConfig() .WithMockConfig()
@@ -475,8 +475,8 @@ TEST_F(DataReductionProxySettingsTest, TestDaysSinceEnabledWithTestClock) {
// that already have data reduction proxy on. // that already have data reduction proxy on.
TEST(DataReductionProxySettingsStandaloneTest, TEST(DataReductionProxySettingsStandaloneTest,
TestDaysSinceEnabledExistingUser) { TestDaysSinceEnabledExistingUser) {
base::test::ScopedTaskEnvironment task_environment{ base::test::TaskEnvironment task_environment{
base::test::ScopedTaskEnvironment::MainThreadType::IO}; base::test::TaskEnvironment::MainThreadType::IO};
std::unique_ptr<DataReductionProxyTestContext> drp_test_context = std::unique_ptr<DataReductionProxyTestContext> drp_test_context =
DataReductionProxyTestContext::Builder() DataReductionProxyTestContext::Builder()
.WithMockConfig() .WithMockConfig()

@@ -41,8 +41,8 @@ TEST(NetworkPropertyTest, TestSetterGetterCaptivePortal) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
TestingPrefServiceSimple test_prefs; TestingPrefServiceSimple test_prefs;
test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties);
base::test::ScopedTaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
TestNetworkPropertiesManager network_properties_manager(&test_prefs); TestNetworkPropertiesManager network_properties_manager(&test_prefs);
std::string network_id("test"); std::string network_id("test");
@@ -92,8 +92,8 @@ TEST(NetworkPropertyTest, TestSetterGetterCaptivePortal) {
TEST(NetworkPropertyTest, TestSetterGetterDisallowedByCarrier) { TEST(NetworkPropertyTest, TestSetterGetterDisallowedByCarrier) {
TestingPrefServiceSimple test_prefs; TestingPrefServiceSimple test_prefs;
test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties);
base::test::ScopedTaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
TestNetworkPropertiesManager network_properties_manager(&test_prefs); TestNetworkPropertiesManager network_properties_manager(&test_prefs);
network_properties_manager.SetIsSecureProxyDisallowedByCarrier(true); network_properties_manager.SetIsSecureProxyDisallowedByCarrier(true);
@@ -110,8 +110,8 @@ TEST(NetworkPropertyTest, TestSetterGetterDisallowedByCarrier) {
TEST(NetworkPropertyTest, TestWarmupURLFailedOnSecureCoreProxy) { TEST(NetworkPropertyTest, TestWarmupURLFailedOnSecureCoreProxy) {
TestingPrefServiceSimple test_prefs; TestingPrefServiceSimple test_prefs;
test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties);
base::test::ScopedTaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
TestNetworkPropertiesManager network_properties_manager(&test_prefs); TestNetworkPropertiesManager network_properties_manager(&test_prefs);
network_properties_manager.SetHasWarmupURLProbeFailed( network_properties_manager.SetHasWarmupURLProbeFailed(
@@ -136,8 +136,8 @@ TEST(NetworkPropertyTest, TestWarmupURLFailedOnSecureCoreProxy) {
TEST(NetworkPropertyTest, TestWarmupURLFailedOnInSecureCoreProxy) { TEST(NetworkPropertyTest, TestWarmupURLFailedOnInSecureCoreProxy) {
TestingPrefServiceSimple test_prefs; TestingPrefServiceSimple test_prefs;
test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties);
base::test::ScopedTaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
TestNetworkPropertiesManager network_properties_manager(&test_prefs); TestNetworkPropertiesManager network_properties_manager(&test_prefs);
EXPECT_TRUE(network_properties_manager.IsInsecureProxyAllowed(true)); EXPECT_TRUE(network_properties_manager.IsInsecureProxyAllowed(true));
@@ -165,8 +165,8 @@ TEST(NetworkPropertyTest, TestWarmupURLFailedOnInSecureCoreProxy) {
TEST(NetworkPropertyTest, TestLimitPrefSize) { TEST(NetworkPropertyTest, TestLimitPrefSize) {
TestingPrefServiceSimple test_prefs; TestingPrefServiceSimple test_prefs;
test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties);
base::test::ScopedTaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
TestNetworkPropertiesManager network_properties_manager(&test_prefs); TestNetworkPropertiesManager network_properties_manager(&test_prefs);
size_t num_network_ids = 100; size_t num_network_ids = 100;
@@ -225,8 +225,8 @@ TEST(NetworkPropertyTest, TestLimitPrefSize) {
TEST(NetworkPropertyTest, TestChangeNetworkIDBackAndForth) { TEST(NetworkPropertyTest, TestChangeNetworkIDBackAndForth) {
TestingPrefServiceSimple test_prefs; TestingPrefServiceSimple test_prefs;
test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties);
base::test::ScopedTaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
TestNetworkPropertiesManager network_properties_manager(&test_prefs); TestNetworkPropertiesManager network_properties_manager(&test_prefs);
// First network ID has a captive portal. // First network ID has a captive portal.
@@ -274,8 +274,8 @@ TEST(NetworkPropertyTest, TestChangeNetworkIDBackAndForth) {
TEST(NetworkPropertyTest, TestNetworkQualitiesOverwrite) { TEST(NetworkPropertyTest, TestNetworkQualitiesOverwrite) {
TestingPrefServiceSimple test_prefs; TestingPrefServiceSimple test_prefs;
test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties);
base::test::ScopedTaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
TestNetworkPropertiesManager network_properties_manager(&test_prefs); TestNetworkPropertiesManager network_properties_manager(&test_prefs);
// First network ID has a captive portal. // First network ID has a captive portal.
@@ -325,8 +325,8 @@ TEST(NetworkPropertyTest, TestDeleteHistory) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
TestingPrefServiceSimple test_prefs; TestingPrefServiceSimple test_prefs;
test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties);
base::test::ScopedTaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
TestNetworkPropertiesManager network_properties_manager(&test_prefs); TestNetworkPropertiesManager network_properties_manager(&test_prefs);
std::string network_id("test"); std::string network_id("test");
@@ -383,8 +383,8 @@ TEST(NetworkPropertyTest, TestDeleteOldValues) {
TestingPrefServiceSimple test_prefs; TestingPrefServiceSimple test_prefs;
test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties);
base::test::ScopedTaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
TestNetworkPropertiesManager network_properties_manager(&test_clock, TestNetworkPropertiesManager network_properties_manager(&test_clock,
&test_prefs); &test_prefs);
@@ -443,8 +443,8 @@ TEST(NetworkPropertyTest,
TestingPrefServiceSimple test_prefs; TestingPrefServiceSimple test_prefs;
test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties); test_prefs.registry()->RegisterDictionaryPref(prefs::kNetworkProperties);
base::test::ScopedTaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
TestNetworkPropertiesManager network_properties_manager(&test_prefs); TestNetworkPropertiesManager network_properties_manager(&test_prefs);
// First network ID has a captive portal and the canary check failed. // First network ID has a captive portal and the canary check failed.

@@ -126,7 +126,7 @@ class WarmupURLFetcherTest : public WarmupURLFetcher {
// Test that query param for the warmup URL is randomly set. // Test that query param for the warmup URL is randomly set.
TEST(WarmupURLFetcherTest, TestGetWarmupURLWithQueryParam) { TEST(WarmupURLFetcherTest, TestGetWarmupURLWithQueryParam) {
base::test::ScopedTaskEnvironment scoped_task_environment; base::test::TaskEnvironment task_environment;
network::TestURLLoaderFactory test_url_loader_factory; network::TestURLLoaderFactory test_url_loader_factory;
WarmupURLFetcherTest warmup_url_fetcher(&test_url_loader_factory); WarmupURLFetcherTest warmup_url_fetcher(&test_url_loader_factory);
@@ -157,7 +157,7 @@ TEST(WarmupURLFetcherTest, TestGetWarmupURLWithQueryParam) {
} }
TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLNoViaHeader) { TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLNoViaHeader) {
base::test::ScopedTaskEnvironment scoped_task_environment; base::test::TaskEnvironment task_environment;
network::TestURLLoaderFactory test_url_loader_factory; network::TestURLLoaderFactory test_url_loader_factory;
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
@@ -167,7 +167,7 @@ TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLNoViaHeader) {
EXPECT_FALSE(warmup_url_fetcher.IsFetchInFlight()); EXPECT_FALSE(warmup_url_fetcher.IsFetchInFlight());
warmup_url_fetcher.FetchWarmupURL(0, DataReductionProxyServer(proxy_server)); warmup_url_fetcher.FetchWarmupURL(0, DataReductionProxyServer(proxy_server));
EXPECT_TRUE(warmup_url_fetcher.IsFetchInFlight()); EXPECT_TRUE(warmup_url_fetcher.IsFetchInFlight());
scoped_task_environment.RunUntilIdle(); task_environment.RunUntilIdle();
auto resource_response_head = auto resource_response_head =
network::CreateResourceResponseHead(net::HTTP_OK); network::CreateResourceResponseHead(net::HTTP_OK);
@@ -203,7 +203,7 @@ TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLNoViaHeader) {
} }
TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLWithViaHeader) { TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLWithViaHeader) {
base::test::ScopedTaskEnvironment scoped_task_environment; base::test::TaskEnvironment task_environment;
network::TestURLLoaderFactory test_url_loader_factory; network::TestURLLoaderFactory test_url_loader_factory;
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
@@ -213,7 +213,7 @@ TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLWithViaHeader) {
EXPECT_FALSE(warmup_url_fetcher.IsFetchInFlight()); EXPECT_FALSE(warmup_url_fetcher.IsFetchInFlight());
warmup_url_fetcher.FetchWarmupURL(0, DataReductionProxyServer(proxy_server)); warmup_url_fetcher.FetchWarmupURL(0, DataReductionProxyServer(proxy_server));
EXPECT_TRUE(warmup_url_fetcher.IsFetchInFlight()); EXPECT_TRUE(warmup_url_fetcher.IsFetchInFlight());
scoped_task_environment.RunUntilIdle(); task_environment.RunUntilIdle();
auto resource_response_head = auto resource_response_head =
network::CreateResourceResponseHead(net::HTTP_NOT_FOUND); network::CreateResourceResponseHead(net::HTTP_NOT_FOUND);
@@ -255,7 +255,7 @@ TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLWithViaHeader) {
TEST(WarmupURLFetcherTest, TEST(WarmupURLFetcherTest,
TestSuccessfulFetchWarmupURLWithViaHeaderExperimentNotEnabled) { TestSuccessfulFetchWarmupURLWithViaHeaderExperimentNotEnabled) {
base::test::ScopedTaskEnvironment scoped_task_environment; base::test::TaskEnvironment task_environment;
network::TestURLLoaderFactory test_url_loader_factory; network::TestURLLoaderFactory test_url_loader_factory;
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
@@ -295,7 +295,7 @@ TEST(WarmupURLFetcherTest,
} }
TEST(WarmupURLFetcherTest, TestConnectionResetFetchWarmupURL) { TEST(WarmupURLFetcherTest, TestConnectionResetFetchWarmupURL) {
base::test::ScopedTaskEnvironment scoped_task_environment; base::test::TaskEnvironment task_environment;
network::TestURLLoaderFactory test_url_loader_factory; network::TestURLLoaderFactory test_url_loader_factory;
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
@@ -337,7 +337,7 @@ TEST(WarmupURLFetcherTest, TestConnectionResetFetchWarmupURL) {
} }
TEST(WarmupURLFetcherTest, TestFetchTimesout) { TEST(WarmupURLFetcherTest, TestFetchTimesout) {
base::test::ScopedTaskEnvironment scoped_task_environment; base::test::TaskEnvironment task_environment;
network::TestURLLoaderFactory test_url_loader_factory; network::TestURLLoaderFactory test_url_loader_factory;
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
@@ -372,8 +372,8 @@ TEST(WarmupURLFetcherTest, TestFetchTimesout) {
} }
TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLWithDelay) { TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLWithDelay) {
base::test::ScopedTaskEnvironment scoped_task_environment( base::test::TaskEnvironment task_environment(
base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME); base::test::TaskEnvironment::TimeSource::MOCK_TIME);
network::TestURLLoaderFactory test_url_loader_factory; network::TestURLLoaderFactory test_url_loader_factory;
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
@@ -383,7 +383,7 @@ TEST(WarmupURLFetcherTest, TestSuccessfulFetchWarmupURLWithDelay) {
EXPECT_FALSE(warmup_url_fetcher.IsFetchInFlight()); EXPECT_FALSE(warmup_url_fetcher.IsFetchInFlight());
warmup_url_fetcher.SetFetchWaitTime(base::TimeDelta::FromMilliseconds(1)); warmup_url_fetcher.SetFetchWaitTime(base::TimeDelta::FromMilliseconds(1));
warmup_url_fetcher.FetchWarmupURL(1, DataReductionProxyServer(proxy_server)); warmup_url_fetcher.FetchWarmupURL(1, DataReductionProxyServer(proxy_server));
scoped_task_environment.FastForwardBy(base::TimeDelta::FromMilliseconds(2)); task_environment.FastForwardBy(base::TimeDelta::FromMilliseconds(2));
auto resource_response_head = auto resource_response_head =
network::CreateResourceResponseHead(net::HTTP_NOT_FOUND); network::CreateResourceResponseHead(net::HTTP_NOT_FOUND);
@@ -430,7 +430,7 @@ TEST(WarmupURLFetcherTest, TestFetchTimeoutIncreasing) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
base::test::ScopedTaskEnvironment scoped_task_environment; base::test::TaskEnvironment task_environment;
network::TestURLLoaderFactory test_url_loader_factory; network::TestURLLoaderFactory test_url_loader_factory;
DataReductionProxyServer proxy_server(net::ProxyServer::Direct()); DataReductionProxyServer proxy_server(net::ProxyServer::Direct());
@@ -460,7 +460,7 @@ TEST(WarmupURLFetcherTest, TestFetchTimeoutIncreasing) {
TEST(WarmupURLFetcherTest, TestFetchWaitTime) { TEST(WarmupURLFetcherTest, TestFetchWaitTime) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
base::test::ScopedTaskEnvironment scoped_task_environment; base::test::TaskEnvironment task_environment;
network::TestURLLoaderFactory test_url_loader_factory; network::TestURLLoaderFactory test_url_loader_factory;
DataReductionProxyServer proxy_server(net::ProxyServer::Direct()); DataReductionProxyServer proxy_server(net::ProxyServer::Direct());

Some files were not shown because too many files have changed in this diff Show More