Index: base/files/file_proxy_unittest.cc |
diff --git a/base/files/file_proxy_unittest.cc b/base/files/file_proxy_unittest.cc |
index bb7e6c31185422fa39a79383f1ebbaf7a7b5006b..774892371709eb11d1cfdf7810c75792a97b0d52 100644 |
--- a/base/files/file_proxy_unittest.cc |
+++ b/base/files/file_proxy_unittest.cc |
@@ -14,6 +14,7 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/message_loop/message_loop.h" |
#include "base/threading/thread.h" |
+#include "base/threading/thread_restrictions.h" |
#include "testing/gtest/include/gtest/gtest.h" |
namespace base { |
@@ -143,6 +144,21 @@ TEST_F(FileProxyTest, CreateOrOpen_OpenNonExistent) { |
EXPECT_FALSE(PathExists(test_path())); |
} |
+TEST_F(FileProxyTest, CreateOrOpen_AbandonedCreate) { |
+ bool prev = ThreadRestrictions::SetIOAllowed(false); |
+ { |
+ FileProxy proxy(file_task_runner()); |
+ proxy.CreateOrOpen( |
+ test_path(), |
+ File::FLAG_CREATE | File::FLAG_READ, |
+ Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr())); |
+ } |
+ MessageLoop::current()->Run(); |
+ ThreadRestrictions::SetIOAllowed(prev); |
+ |
+ EXPECT_TRUE(PathExists(test_path())); |
+} |
+ |
TEST_F(FileProxyTest, Close) { |
// Creates a file. |
FileProxy proxy(file_task_runner()); |