Replace base::MockTimer with behavior-specific timers

This CL replaces most MockTimer with MockOneShotTimer or
MockRepeatingTimer as a preparation of OnceCallback support of
base::Timer.

Bug: 850247
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:ios-simulator-full-configs;luci.chromium.try:linux_mojo;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:linux_vr;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I949bc78c5e103baa610a8a2d1197901ceb090c50
Reviewed-on: https://chromium-review.googlesource.com/1105812
Commit-Queue: Taiju Tsuiki <[email protected]>
Reviewed-by: Kentaro Hara <[email protected]>
Reviewed-by: Yutaka Hirano <[email protected]>
Reviewed-by: Joshua Bell <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Reviewed-by: Lambros Lambrou <[email protected]>
Cr-Commit-Position: refs/heads/master@{#572509}
diff --git a/base/files/important_file_writer_unittest.cc b/base/files/important_file_writer_unittest.cc
index 05a3bd2..5dddc71 100644
--- a/base/files/important_file_writer_unittest.cc
+++ b/base/files/important_file_writer_unittest.cc
@@ -231,7 +231,7 @@
 
 TEST_F(ImportantFileWriterTest, ScheduleWrite) {
   constexpr TimeDelta kCommitInterval = TimeDelta::FromSeconds(12345);
-  MockTimer timer(true, false);
+  MockOneShotTimer timer;
   ImportantFileWriter writer(file_, ThreadTaskRunnerHandle::Get(),
                              kCommitInterval);
   writer.SetTimerForTesting(&timer);
@@ -250,7 +250,7 @@
 }
 
 TEST_F(ImportantFileWriterTest, DoScheduledWrite) {
-  MockTimer timer(true, false);
+  MockOneShotTimer timer;
   ImportantFileWriter writer(file_, ThreadTaskRunnerHandle::Get());
   writer.SetTimerForTesting(&timer);
   EXPECT_FALSE(writer.HasPendingWrite());
@@ -265,7 +265,7 @@
 }
 
 TEST_F(ImportantFileWriterTest, BatchingWrites) {
-  MockTimer timer(true, false);
+  MockOneShotTimer timer;
   ImportantFileWriter writer(file_, ThreadTaskRunnerHandle::Get());
   writer.SetTimerForTesting(&timer);
   DataSerializer foo("foo"), bar("bar"), baz("baz");
@@ -280,7 +280,7 @@
 }
 
 TEST_F(ImportantFileWriterTest, ScheduleWrite_FailToSerialize) {
-  MockTimer timer(true, false);
+  MockOneShotTimer timer;
   ImportantFileWriter writer(file_, ThreadTaskRunnerHandle::Get());
   writer.SetTimerForTesting(&timer);
   EXPECT_FALSE(writer.HasPendingWrite());
@@ -295,7 +295,7 @@
 }
 
 TEST_F(ImportantFileWriterTest, ScheduleWrite_WriteNow) {
-  MockTimer timer(true, false);
+  MockOneShotTimer timer;
   ImportantFileWriter writer(file_, ThreadTaskRunnerHandle::Get());
   writer.SetTimerForTesting(&timer);
   EXPECT_FALSE(writer.HasPendingWrite());
@@ -312,7 +312,7 @@
 }
 
 TEST_F(ImportantFileWriterTest, DoScheduledWrite_FailToSerialize) {
-  MockTimer timer(true, false);
+  MockOneShotTimer timer;
   ImportantFileWriter writer(file_, ThreadTaskRunnerHandle::Get());
   writer.SetTimerForTesting(&timer);
   EXPECT_FALSE(writer.HasPendingWrite());