summaryrefslogtreecommitdiffstats
path: root/ppapi/tests/test_file_ref.cc
diff options
context:
space:
mode:
authornhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-22 06:45:46 +0000
committernhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-22 06:45:46 +0000
commit81568bb35a07b5acd14cde15d6726a3c6c467f35 (patch)
tree644e623cfcfae1ad1de8e4c928239ddd7b3538c4 /ppapi/tests/test_file_ref.cc
parent15a709678b5d23e9c6f9021bb1c5a32be5d9336c (diff)
downloadchromium_src-81568bb35a07b5acd14cde15d6726a3c6c467f35.zip
chromium_src-81568bb35a07b5acd14cde15d6726a3c6c467f35.tar.gz
chromium_src-81568bb35a07b5acd14cde15d6726a3c6c467f35.tar.bz2
Implement ReadEntries API for PPB_DirectoryReader
The ReadEntries API returns all file entries in the given directory at once. API discussion is here: https://codereview.chromium.org/12026008/ BUG=113086 TEST=browser_tests --gtest_filter=\*DirectoryReader\* Review URL: https://chromiumcodereview.appspot.com/12090071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184054 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests/test_file_ref.cc')
-rw-r--r--ppapi/tests/test_file_ref.cc25
1 files changed, 11 insertions, 14 deletions
diff --git a/ppapi/tests/test_file_ref.cc b/ppapi/tests/test_file_ref.cc
index b1638b7..09260120 100644
--- a/ppapi/tests/test_file_ref.cc
+++ b/ppapi/tests/test_file_ref.cc
@@ -716,26 +716,23 @@ std::string TestFileRef::TestFileNameEscaping() {
// DirectoryReader only works out-of-process.
if (testing_interface_->IsOutOfProcess()) {
+ TestCompletionCallbackWithOutput< std::vector<pp::DirectoryEntry_Dev> >
+ output_callback(instance_->pp_instance(), force_async_);
pp::DirectoryReader_Dev directory_reader(test_dir_ref);
- pp::DirectoryEntry_Dev entry;
- rv = directory_reader.GetNextEntry(&entry, callback);
+ rv = directory_reader.ReadEntries(output_callback);
if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
+ rv = output_callback.WaitForResult();
if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
- return ReportError("DirectoryEntry_Dev::GetNextEntry", rv);
- if (entry.is_null())
- return "Entry was not found.";
- if (entry.file_ref().GetName().AsString() != kTerribleName)
- return "Entry name did not match.";
+ return ReportError("DirectoryEntry_Dev::ReadEntries", rv);
- rv = directory_reader.GetNextEntry(&entry, callback);
- if (rv == PP_OK_COMPLETIONPENDING)
- rv = callback.WaitForResult();
- if (rv != PP_OK && rv != PP_ERROR_FILENOTFOUND)
- return ReportError("DirectoryEntry_Dev::GetNextEntry", rv);
- if (!entry.is_null())
+ std::vector<pp::DirectoryEntry_Dev> entries = output_callback.output();
+ if (entries.empty())
+ return "Entry was not found.";
+ if (entries.size() != 1)
return "Directory had too many entries.";
+ if (entries.front().file_ref().GetName().AsString() != kTerribleName)
+ return "Entry name did not match.";
}
PASS();