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 79995ff083edaae91e48ccd150a7b90523039713..27299a4bf6450d219c7fe4d3dc700a2f3136352c 100644 |
| --- a/ppapi/tests/test_file_io.cc |
| +++ b/ppapi/tests/test_file_io.cc |
| @@ -904,6 +904,31 @@ std::string TestFileIO::TestNotAllowMixedReadWrite() { |
| if (rv_2 != PP_ERROR_INPROGRESS) |
| return ReportError("FileIO::Read", rv_2); |
| + // Can not query while the write is pending. |
|
viettrungluu
2011/12/01 22:59:43
nit: s/Can not/Cannot/
They mean different things
|
| + 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); |
| + |
| + // Can not 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); |
| + |
| + // Can not 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(); |
| @@ -941,10 +966,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( |