diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-09 17:49:43 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-09 17:49:43 +0000 |
commit | 4bfc70fc7662aca658c3c45772e428c2f3b66b58 (patch) | |
tree | 710c01b51bb31168c96e19ebc79ee5ee17f6fbf3 /ppapi/tests/test_file_io.cc | |
parent | 470c2dd686dbe89022f5d80b211f0f920ed2085c (diff) | |
download | chromium_src-4bfc70fc7662aca658c3c45772e428c2f3b66b58.zip chromium_src-4bfc70fc7662aca658c3c45772e428c2f3b66b58.tar.gz chromium_src-4bfc70fc7662aca658c3c45772e428c2f3b66b58.tar.bz2 |
Implement a proxy for Pepper FileIO.
[ Reland of 113565 http://codereview.chromium.org/8764003 ]
This splits apart the old in-process implementation into a new object in shared_impl that does most of the general tracking. This alllows that code to be shared by the proxy.
BUG=http://crbug.com/101154
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113817 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests/test_file_io.cc')
-rw-r--r-- | ppapi/tests/test_file_io.cc | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/ppapi/tests/test_file_io.cc b/ppapi/tests/test_file_io.cc index b04c7e9..057fdef 100644 --- a/ppapi/tests/test_file_io.cc +++ b/ppapi/tests/test_file_io.cc @@ -903,6 +903,31 @@ std::string TestFileIO::TestNotAllowMixedReadWrite() { if (rv_2 != PP_ERROR_INPROGRESS) return ReportError("FileIO::Read", rv_2); + // Cannot query while the write is pending. + TestCompletionCallback callback_3(instance_->pp_instance(), force_async_); + PP_FileInfo info; + int32_t rv_3 = file_io.Query(&info, callback_3); + if (rv_3 == PP_OK_COMPLETIONPENDING) + rv_3 = callback_3.WaitForResult(); + if (rv_3 != PP_ERROR_INPROGRESS) + return ReportError("FileIO::Query", rv_3); + + // Cannot touch while the write is pending. + TestCompletionCallback callback_4(instance_->pp_instance(), force_async_); + int32_t rv_4 = file_io.Touch(1234.0, 5678.0, callback_4); + if (rv_4 == PP_OK_COMPLETIONPENDING) + rv_4 = callback_4.WaitForResult(); + if (rv_4 != PP_ERROR_INPROGRESS) + return ReportError("FileIO::Touch", rv_4); + + // Cannot set length while the write is pending. + TestCompletionCallback callback_5(instance_->pp_instance(), force_async_); + int32_t rv_5 = file_io.SetLength(123, callback_5); + if (rv_5 == PP_OK_COMPLETIONPENDING) + rv_5 = callback_5.WaitForResult(); + if (rv_5 != PP_ERROR_INPROGRESS) + return ReportError("FileIO::SetLength", rv_5); + callback_1.WaitForResult(); PASS(); @@ -940,10 +965,14 @@ std::string TestFileIO::TestWillWriteWillSetLength() { if (!trusted) return ReportError("FileIOTrusted", PP_ERROR_FAILED); - // Get file descriptor. - int32_t fd = trusted->GetOSFileDescriptor(file_io.pp_resource()); - if (fd < 0) - return "FileIO::GetOSFileDescriptor() returned a bad file descriptor."; + // Get file descriptor. This is only supported in-process for now, so don't + // test out of process. + const PPB_Testing_Dev* testing_interface = GetTestingInterface(); + if (testing_interface && !testing_interface->IsOutOfProcess()) { + int32_t fd = trusted->GetOSFileDescriptor(file_io.pp_resource()); + if (fd < 0) + return "FileIO::GetOSFileDescriptor() returned a bad file descriptor."; + } // Calling WillWrite. rv = trusted->WillWrite( |