Index: base/files/important_file_writer_unittest.cc |
diff --git a/base/files/important_file_writer_unittest.cc b/base/files/important_file_writer_unittest.cc |
index 170c2b2d89ab14f70b409c8a145d716a33728a8e..d376cdc35ab33cd2491bb69c114f4981ad3eabf1 100644 |
--- a/base/files/important_file_writer_unittest.cc |
+++ b/base/files/important_file_writer_unittest.cc |
@@ -9,9 +9,11 @@ |
#include "base/files/file_path.h" |
#include "base/files/file_util.h" |
#include "base/files/scoped_temp_dir.h" |
+#include "base/location.h" |
#include "base/logging.h" |
-#include "base/message_loop/message_loop.h" |
#include "base/run_loop.h" |
+#include "base/single_thread_task_runner.h" |
+#include "base/thread_task_runner_handle.h" |
#include "base/threading/thread.h" |
#include "base/time/time.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -97,7 +99,7 @@ class ImportantFileWriterTest : public testing::Test { |
}; |
TEST_F(ImportantFileWriterTest, Basic) { |
- ImportantFileWriter writer(file_, MessageLoopProxy::current().get()); |
+ ImportantFileWriter writer(file_, ThreadTaskRunnerHandle::Get()); |
EXPECT_FALSE(PathExists(writer.path())); |
EXPECT_FALSE(successful_write_observer_.GetAndResetObservationState()); |
writer.WriteNow(make_scoped_ptr(new std::string("foo"))); |
@@ -109,7 +111,7 @@ TEST_F(ImportantFileWriterTest, Basic) { |
} |
TEST_F(ImportantFileWriterTest, BasicWithSuccessfulWriteObserver) { |
- ImportantFileWriter writer(file_, MessageLoopProxy::current().get()); |
+ ImportantFileWriter writer(file_, ThreadTaskRunnerHandle::Get()); |
EXPECT_FALSE(PathExists(writer.path())); |
EXPECT_FALSE(successful_write_observer_.GetAndResetObservationState()); |
successful_write_observer_.ObserveNextSuccessfulWrite(&writer); |
@@ -143,15 +145,14 @@ TEST_F(ImportantFileWriterTest, BasicWithSuccessfulWriteObserver) { |
} |
TEST_F(ImportantFileWriterTest, ScheduleWrite) { |
- ImportantFileWriter writer(file_, MessageLoopProxy::current().get()); |
+ ImportantFileWriter writer(file_, ThreadTaskRunnerHandle::Get()); |
writer.set_commit_interval(TimeDelta::FromMilliseconds(25)); |
EXPECT_FALSE(writer.HasPendingWrite()); |
DataSerializer serializer("foo"); |
writer.ScheduleWrite(&serializer); |
EXPECT_TRUE(writer.HasPendingWrite()); |
- MessageLoop::current()->PostDelayedTask( |
- FROM_HERE, |
- MessageLoop::QuitWhenIdleClosure(), |
+ ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
+ FROM_HERE, MessageLoop::QuitWhenIdleClosure(), |
TimeDelta::FromMilliseconds(100)); |
MessageLoop::current()->Run(); |
EXPECT_FALSE(writer.HasPendingWrite()); |
@@ -160,15 +161,14 @@ TEST_F(ImportantFileWriterTest, ScheduleWrite) { |
} |
TEST_F(ImportantFileWriterTest, DoScheduledWrite) { |
- ImportantFileWriter writer(file_, MessageLoopProxy::current().get()); |
+ ImportantFileWriter writer(file_, ThreadTaskRunnerHandle::Get()); |
EXPECT_FALSE(writer.HasPendingWrite()); |
DataSerializer serializer("foo"); |
writer.ScheduleWrite(&serializer); |
EXPECT_TRUE(writer.HasPendingWrite()); |
writer.DoScheduledWrite(); |
- MessageLoop::current()->PostDelayedTask( |
- FROM_HERE, |
- MessageLoop::QuitWhenIdleClosure(), |
+ ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
+ FROM_HERE, MessageLoop::QuitWhenIdleClosure(), |
TimeDelta::FromMilliseconds(100)); |
MessageLoop::current()->Run(); |
EXPECT_FALSE(writer.HasPendingWrite()); |
@@ -177,15 +177,14 @@ TEST_F(ImportantFileWriterTest, DoScheduledWrite) { |
} |
TEST_F(ImportantFileWriterTest, BatchingWrites) { |
- ImportantFileWriter writer(file_, MessageLoopProxy::current().get()); |
+ ImportantFileWriter writer(file_, ThreadTaskRunnerHandle::Get()); |
writer.set_commit_interval(TimeDelta::FromMilliseconds(25)); |
DataSerializer foo("foo"), bar("bar"), baz("baz"); |
writer.ScheduleWrite(&foo); |
writer.ScheduleWrite(&bar); |
writer.ScheduleWrite(&baz); |
- MessageLoop::current()->PostDelayedTask( |
- FROM_HERE, |
- MessageLoop::QuitWhenIdleClosure(), |
+ ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
+ FROM_HERE, MessageLoop::QuitWhenIdleClosure(), |
TimeDelta::FromMilliseconds(100)); |
MessageLoop::current()->Run(); |
ASSERT_TRUE(PathExists(writer.path())); |