[TaskEnvironment] Mass-migrate away from ScopedTaskEnvironment

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

This is step #1 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-Original-Commit-Position: refs/heads/master@{#688142}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: dfa3604eca9277f044caaf6ff5744075f26fe81f
diff --git a/alarm_timer_unittest.cc b/alarm_timer_unittest.cc
index 166144e..6e45727 100644
--- a/alarm_timer_unittest.cc
+++ b/alarm_timer_unittest.cc
@@ -97,8 +97,8 @@
 // that timers work properly in all configurations.
 
 TEST(AlarmTimerTest, SimpleAlarmTimer) {
-  base::test::ScopedTaskEnvironment task_environment(
-      base::test::ScopedTaskEnvironment::MainThreadType::IO);
+  base::test::TaskEnvironment task_environment(
+      base::test::TaskEnvironment::MainThreadType::IO);
 
   base::RunLoop run_loop;
   bool did_run = false;
@@ -112,8 +112,8 @@
 }
 
 TEST(AlarmTimerTest, SimpleAlarmTimer_Cancel) {
-  base::test::ScopedTaskEnvironment task_environment(
-      base::test::ScopedTaskEnvironment::MainThreadType::IO);
+  base::test::TaskEnvironment task_environment(
+      base::test::TaskEnvironment::MainThreadType::IO);
 
   bool did_run_a = false;
   AlarmTimerTester* a =
@@ -140,8 +140,8 @@
 // If underlying timer does not handle this properly, we will crash or fail
 // in full page heap environment.
 TEST(AlarmTimerTest, SelfDeletingAlarmTimer) {
-  base::test::ScopedTaskEnvironment task_environment(
-      base::test::ScopedTaskEnvironment::MainThreadType::IO);
+  base::test::TaskEnvironment task_environment(
+      base::test::TaskEnvironment::MainThreadType::IO);
 
   base::RunLoop run_loop;
   bool did_run = false;
@@ -155,8 +155,8 @@
 }
 
 TEST(AlarmTimerTest, AlarmTimerZeroDelay) {
-  base::test::ScopedTaskEnvironment task_environment(
-      base::test::ScopedTaskEnvironment::MainThreadType::IO);
+  base::test::TaskEnvironment task_environment(
+      base::test::TaskEnvironment::MainThreadType::IO);
 
   base::RunLoop run_loop;
   bool did_run = false;
@@ -170,8 +170,8 @@
 }
 
 TEST(AlarmTimerTest, AlarmTimerZeroDelay_Cancel) {
-  base::test::ScopedTaskEnvironment task_environment(
-      base::test::ScopedTaskEnvironment::MainThreadType::IO);
+  base::test::TaskEnvironment task_environment(
+      base::test::TaskEnvironment::MainThreadType::IO);
 
   bool did_run_a = false;
   AlarmTimerTester* a =
@@ -202,8 +202,8 @@
   // if debug heap checking is enabled.
   bool did_run = false;
   {
-    base::test::ScopedTaskEnvironment task_environment(
-        base::test::ScopedTaskEnvironment::MainThreadType::IO);
+    base::test::TaskEnvironment task_environment(
+        base::test::TaskEnvironment::MainThreadType::IO);
 
     AlarmTimerTester a(&did_run, kTenMilliseconds, base::OnceClosure());
     AlarmTimerTester b(&did_run, kTenMilliseconds, base::OnceClosure());
@@ -223,8 +223,8 @@
 }
 
 TEST(AlarmTimerTest, NonRepeatIsRunning) {
-  base::test::ScopedTaskEnvironment task_environment(
-      base::test::ScopedTaskEnvironment::MainThreadType::IO);
+  base::test::TaskEnvironment task_environment(
+      base::test::TaskEnvironment::MainThreadType::IO);
 
   auto timer = SimpleAlarmTimer::CreateForTesting();
   EXPECT_FALSE(timer->IsRunning());
@@ -244,8 +244,8 @@
 }
 
 TEST(AlarmTimerTest, RetainNonRepeatIsRunning) {
-  base::test::ScopedTaskEnvironment task_environment(
-      base::test::ScopedTaskEnvironment::MainThreadType::IO);
+  base::test::TaskEnvironment task_environment(
+      base::test::TaskEnvironment::MainThreadType::IO);
 
   auto timer = SimpleAlarmTimer::CreateForTesting();
   EXPECT_FALSE(timer->IsRunning());
@@ -290,8 +290,8 @@
 
 TEST(AlarmTimerTest, ContinuationStopStart) {
   ClearAllCallbackHappened();
-  base::test::ScopedTaskEnvironment task_environment(
-      base::test::ScopedTaskEnvironment::MainThreadType::IO);
+  base::test::TaskEnvironment task_environment(
+      base::test::TaskEnvironment::MainThreadType::IO);
 
   auto timer = SimpleAlarmTimer::CreateForTesting();
   timer->Start(FROM_HERE, base::TimeDelta::FromMilliseconds(10),
@@ -311,8 +311,8 @@
 
 TEST(AlarmTimerTest, ContinuationReset) {
   ClearAllCallbackHappened();
-  base::test::ScopedTaskEnvironment task_environment(
-      base::test::ScopedTaskEnvironment::MainThreadType::IO);
+  base::test::TaskEnvironment task_environment(
+      base::test::TaskEnvironment::MainThreadType::IO);
 
   base::RunLoop run_loop;
   auto timer = SimpleAlarmTimer::CreateForTesting();
@@ -328,8 +328,8 @@
 // Verify that no crash occurs if a timer is deleted while its callback is
 // running.
 TEST(AlarmTimerTest, DeleteTimerWhileCallbackIsRunning) {
-  base::test::ScopedTaskEnvironment task_environment(
-      base::test::ScopedTaskEnvironment::MainThreadType::IO);
+  base::test::TaskEnvironment task_environment(
+      base::test::TaskEnvironment::MainThreadType::IO);
 
   base::RunLoop run_loop;
 
@@ -347,8 +347,8 @@
 // Verify that no crash occurs if a zero-delay timer is deleted while its
 // callback is running.
 TEST(AlarmTimerTest, DeleteTimerWhileCallbackIsRunningZeroDelay) {
-  base::test::ScopedTaskEnvironment task_environment(
-      base::test::ScopedTaskEnvironment::MainThreadType::IO);
+  base::test::TaskEnvironment task_environment(
+      base::test::TaskEnvironment::MainThreadType::IO);
   base::RunLoop run_loop;
 
   // Will be deleted by the callback.