Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: ppapi/tests/test_url_loader.cc

Issue 8764003: Implement a proxy for Pepper FileIO. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Homestarmy Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/tests/test_file_io.cc ('k') | ppapi/thunk/interfaces_ppb_private.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_url_loader.cc
diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc
index ce6f6d94e68cd7252a700ac5ac5665899615e70c..fc72948a01655c0b40c571e66c17890226173a45 100644
--- a/ppapi/tests/test_url_loader.cc
+++ b/ppapi/tests/test_url_loader.cc
@@ -71,22 +71,14 @@ bool TestURLLoader::Init() {
const PPB_FileIO* file_io_interface = static_cast<const PPB_FileIO*>(
pp::Module::Get()->GetBrowserInterface(PPB_FILEIO_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) {
+ if (!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() && file_io_trusted_interface_) {
- instance_->AppendError(
- "FileIOTrusted interface is now supported by ppapi proxy: "
- "update this test!");
- } else if (!testing_interface_->IsOutOfProcess()) {
+ if (!testing_interface_->IsOutOfProcess()) {
// Trusted interfaces are not supported under NaCl.
#if !(defined __native_client__)
if (!file_io_trusted_interface_)
@@ -470,36 +462,34 @@ std::string TestURLLoader::TestStreamToFile() {
return ReportError("URLLoader::FinishStreamingToFile", rv);
// FileIO is not yet supported by ppapi/proxy.
- 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);
+ 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();
}
« no previous file with comments | « ppapi/tests/test_file_io.cc ('k') | ppapi/thunk/interfaces_ppb_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698