Chromium Code Reviews| Index: ppapi/tests/test_file_io.cc |
| diff --git a/ppapi/tests/test_file_io.cc b/ppapi/tests/test_file_io.cc |
| index 620344e834e58c5ce69331f508dc8d5db20b22e2..caba877d2bae78b7ed206fbeaf692a809134cbc3 100644 |
| --- a/ppapi/tests/test_file_io.cc |
| +++ b/ppapi/tests/test_file_io.cc |
| @@ -184,6 +184,7 @@ void TestFileIO::RunTests(const std::string& filter) { |
| RUN_CALLBACK_TEST(TestFileIO, NotAllowMixedReadWrite, filter); |
| RUN_CALLBACK_TEST(TestFileIO, WillWriteWillSetLength, filter); |
| RUN_CALLBACK_TEST(TestFileIO, RequestOSFileHandle, filter); |
| + RUN_CALLBACK_TEST(TestFileIO, RequestOSFileHandleWithOpenExclusive, filter); |
| RUN_CALLBACK_TEST(TestFileIO, Mmap, filter); |
| // TODO(viettrungluu): add tests: |
| @@ -1108,6 +1109,39 @@ std::string TestFileIO::TestRequestOSFileHandle() { |
| PASS(); |
| } |
| +// Calling RequestOSFileHandle with the FileIO that is opened with |
| +// PP_FILEOPENFLAG_EXCLUSIVE used to cause NaCl module to crash while loading. |
| +// This is a regression test for that issue. |
|
dmichael (off chromium)
2013/05/30 05:17:15
Please reference the bug here.
mazda
2013/05/30 05:35:18
Done.
|
| +std::string TestFileIO::TestRequestOSFileHandleWithOpenExclusive() { |
| + TestCompletionCallback callback(instance_->pp_instance(), callback_type()); |
| + |
| + pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); |
| + pp::FileRef file_ref(file_system, "/file_os_fd2"); |
| + |
| + callback.WaitForResult(file_system.Open(1024, callback.GetCallback())); |
| + ASSERT_EQ(PP_OK, callback.result()); |
| + |
| + pp::FileIO_Private file_io(instance_); |
| + callback.WaitForResult(file_io.Open(file_ref, |
| + PP_FILEOPENFLAG_CREATE | |
| + PP_FILEOPENFLAG_READ | |
| + PP_FILEOPENFLAG_WRITE | |
| + PP_FILEOPENFLAG_EXCLUSIVE, |
| + callback.GetCallback())); |
| + ASSERT_EQ(PP_OK, callback.result()); |
| + |
| + TestCompletionCallbackWithOutput<pp::PassFileHandle> output_callback( |
| + instance_->pp_instance(), callback_type()); |
| + output_callback.WaitForResult( |
| + file_io.RequestOSFileHandle(output_callback.GetCallback())); |
| + PP_FileHandle handle = output_callback.output().Release(); |
| + if (handle == PP_kInvalidFileHandle) |
| + return "FileIO::RequestOSFileHandle() returned a bad file handle."; |
| + ASSERT_EQ(PP_OK, output_callback.result()); |
| + |
| + PASS(); |
| +} |
| + |
| std::string TestFileIO::TestMmap() { |
| #if !defined(PPAPI_OS_WIN) |
| TestCompletionCallback callback(instance_->pp_instance(), callback_type()); |