summaryrefslogtreecommitdiffstats
path: root/ppapi/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/tests')
-rw-r--r--ppapi/tests/test_file_io.cc37
-rw-r--r--ppapi/tests/test_url_loader.cc60
2 files changed, 39 insertions, 58 deletions
diff --git a/ppapi/tests/test_file_io.cc b/ppapi/tests/test_file_io.cc
index 057fdef..b04c7e9 100644
--- a/ppapi/tests/test_file_io.cc
+++ b/ppapi/tests/test_file_io.cc
@@ -903,31 +903,6 @@ 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();
@@ -965,14 +940,10 @@ std::string TestFileIO::TestWillWriteWillSetLength() {
if (!trusted)
return ReportError("FileIOTrusted", PP_ERROR_FAILED);
- // 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.";
- }
+ // Get file descriptor.
+ 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(
diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc
index f379c31..f55694c 100644
--- a/ppapi/tests/test_url_loader.cc
+++ b/ppapi/tests/test_url_loader.cc
@@ -70,14 +70,22 @@ bool TestURLLoader::Init() {
const PPB_FileIO* file_io_interface = static_cast<const PPB_FileIO*>(
pp::Module::Get()->GetBrowserInterface(PPB_FILEIO_INTERFACE));
- if (!file_io_interface)
+ if (testing_interface_->IsOutOfProcess() && file_io_interface) {
+ instance_->AppendError(
+ "FileIO interface is now supported by ppapi proxy: update this test!");
+ } else if (!testing_interface_->IsOutOfProcess() && !file_io_interface) {
instance_->AppendError("FileIO interface not available");
+ }
file_io_trusted_interface_ = static_cast<const PPB_FileIOTrusted*>(
pp::Module::Get()->GetBrowserInterface(PPB_FILEIOTRUSTED_INTERFACE));
url_loader_trusted_interface_ = static_cast<const PPB_URLLoaderTrusted*>(
pp::Module::Get()->GetBrowserInterface(PPB_URLLOADERTRUSTED_INTERFACE));
- if (!testing_interface_->IsOutOfProcess()) {
+ if (testing_interface_->IsOutOfProcess() && file_io_trusted_interface_) {
+ instance_->AppendError(
+ "FileIOTrusted interface is now supported by ppapi proxy: "
+ "update this test!");
+ } else if (!testing_interface_->IsOutOfProcess()) {
// Trusted interfaces are not supported under NaCl.
#if !(defined __native_client__)
if (!file_io_trusted_interface_)
@@ -472,34 +480,36 @@ std::string TestURLLoader::TestStreamToFile() {
return ReportError("URLLoader::FinishStreamingToFile", rv);
// FileIO is not yet supported by ppapi/proxy.
- pp::FileIO reader(instance_);
- rv = reader.Open(body, PP_FILEOPENFLAG_READ, callback);
- if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
- return ReportError("FileIO::Open force_async", rv);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("FileIO::Open", rv);
+ if (!testing_interface_->IsOutOfProcess()) {
+ pp::FileIO reader(instance_);
+ rv = reader.Open(body, PP_FILEOPENFLAG_READ, callback);
+ if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+ return ReportError("FileIO::Open force_async", rv);
+ if (rv == PP_OK_COMPLETIONPENDING)
+ rv = callback.WaitForResult();
+ if (rv != PP_OK)
+ return ReportError("FileIO::Open", rv);
- std::string data;
- std::string error = ReadEntireFile(&reader, &data);
- if (!error.empty())
- return error;
+ std::string data;
+ std::string error = ReadEntireFile(&reader, &data);
+ if (!error.empty())
+ return error;
- std::string expected_body = "hello\n";
- if (data.size() != expected_body.size())
- return "ReadEntireFile returned unexpected content length";
- if (data != expected_body)
- return "ReadEntireFile returned unexpected content";
+ std::string expected_body = "hello\n";
+ if (data.size() != expected_body.size())
+ return "ReadEntireFile returned unexpected content length";
+ if (data != expected_body)
+ return "ReadEntireFile returned unexpected content";
- // FileIOTrusted is not supported by NaCl or ppapi/proxy.
- if (!testing_interface_->IsOutOfProcess()) {
+ // FileIOTrusted is not supported by NaCl or ppapi/proxy.
+ if (!testing_interface_->IsOutOfProcess()) {
#if !(defined __native_client__)
- int32_t file_descriptor = file_io_trusted_interface_->GetOSFileDescriptor(
- reader.pp_resource());
- if (file_descriptor < 0)
- return "FileIO::GetOSFileDescriptor() returned a bad file descriptor.";
+ int32_t file_descriptor = file_io_trusted_interface_->GetOSFileDescriptor(
+ reader.pp_resource());
+ if (file_descriptor < 0)
+ return "FileIO::GetOSFileDescriptor() returned a bad file descriptor.";
#endif
+ }
}
PASS();
}