Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: base/files/file_proxy_unittest.cc

Issue 2103333006: Remove calls to deprecated MessageLoop methods in base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/files/file_path_watcher_unittest.cc ('k') | base/files/file_util_proxy_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_proxy_unittest.cc
diff --git a/base/files/file_proxy_unittest.cc b/base/files/file_proxy_unittest.cc
index 2562208b2707528cc72ea67eb9c1a43cf5946112..d6a4a1edbfcf01c2f8f71fbf25c2a1d4e5847d11 100644
--- a/base/files/file_proxy_unittest.cc
+++ b/base/files/file_proxy_unittest.cc
@@ -15,6 +15,7 @@
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/run_loop.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
@@ -80,7 +81,7 @@ class FileProxyTest : public testing::Test {
proxy->CreateOrOpen(
test_path(), flags,
Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
EXPECT_TRUE(proxy->IsValid());
}
@@ -108,7 +109,7 @@ TEST_F(FileProxyTest, CreateOrOpen_Create) {
test_path(),
File::FLAG_CREATE | File::FLAG_READ,
Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
EXPECT_TRUE(proxy.IsValid());
@@ -127,7 +128,7 @@ TEST_F(FileProxyTest, CreateOrOpen_Open) {
test_path(),
File::FLAG_OPEN | File::FLAG_READ,
Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
EXPECT_TRUE(proxy.IsValid());
@@ -140,7 +141,7 @@ TEST_F(FileProxyTest, CreateOrOpen_OpenNonExistent) {
test_path(),
File::FLAG_OPEN | File::FLAG_READ,
Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
EXPECT_EQ(File::FILE_ERROR_NOT_FOUND, error_);
EXPECT_FALSE(proxy.IsValid());
EXPECT_FALSE(proxy.created());
@@ -156,7 +157,7 @@ TEST_F(FileProxyTest, CreateOrOpen_AbandonedCreate) {
File::FLAG_CREATE | File::FLAG_READ,
Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
}
- MessageLoop::current()->Run();
+ RunLoop().Run();
ThreadRestrictions::SetIOAllowed(prev);
EXPECT_TRUE(PathExists(test_path()));
@@ -173,7 +174,7 @@ TEST_F(FileProxyTest, Close) {
#endif
proxy.Close(Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
EXPECT_FALSE(proxy.IsValid());
@@ -187,7 +188,7 @@ TEST_F(FileProxyTest, CreateTemporary) {
proxy.CreateTemporary(
0 /* additional_file_flags */,
Bind(&FileProxyTest::DidCreateTemporary, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
EXPECT_TRUE(proxy.IsValid());
EXPECT_EQ(File::FILE_OK, error_);
@@ -196,7 +197,7 @@ TEST_F(FileProxyTest, CreateTemporary) {
// The file should be writable.
proxy.Write(0, "test", 4,
Bind(&FileProxyTest::DidWrite, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(4, bytes_written_);
}
@@ -235,7 +236,7 @@ TEST_F(FileProxyTest, GetInfo) {
CreateProxy(File::FLAG_OPEN | File::FLAG_READ, &proxy);
proxy.GetInfo(
Bind(&FileProxyTest::DidGetFileInfo, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
// Verify.
EXPECT_EQ(File::FILE_OK, error_);
@@ -258,7 +259,7 @@ TEST_F(FileProxyTest, Read) {
CreateProxy(File::FLAG_OPEN | File::FLAG_READ, &proxy);
proxy.Read(0, 128, Bind(&FileProxyTest::DidRead, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
// Verify.
EXPECT_EQ(File::FILE_OK, error_);
@@ -276,14 +277,14 @@ TEST_F(FileProxyTest, WriteAndFlush) {
int data_bytes = arraysize(data);
proxy.Write(0, data, data_bytes,
Bind(&FileProxyTest::DidWrite, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(data_bytes, bytes_written_);
// Flush the written data. (So that the following read should always
// succeed. On some platforms it may work with or without this flush.)
proxy.Flush(Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
// Verify the written data.
@@ -311,7 +312,7 @@ TEST_F(FileProxyTest, MAYBE_SetTimes) {
proxy.SetTimes(last_accessed_time, last_modified_time,
Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
File::Info info;
@@ -338,7 +339,7 @@ TEST_F(FileProxyTest, SetLength_Shrink) {
CreateProxy(File::FLAG_OPEN | File::FLAG_WRITE, &proxy);
proxy.SetLength(7,
Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
// Verify.
GetFileInfo(test_path(), &info);
@@ -364,7 +365,7 @@ TEST_F(FileProxyTest, SetLength_Expand) {
CreateProxy(File::FLAG_OPEN | File::FLAG_WRITE, &proxy);
proxy.SetLength(53,
Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
- MessageLoop::current()->Run();
+ RunLoop().Run();
// Verify.
GetFileInfo(test_path(), &info);
« no previous file with comments | « base/files/file_path_watcher_unittest.cc ('k') | base/files/file_util_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698