summaryrefslogtreecommitdiffstats
path: root/ppapi/tests/test_file_system.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/tests/test_file_system.cc')
-rw-r--r--ppapi/tests/test_file_system.cc29
1 files changed, 18 insertions, 11 deletions
diff --git a/ppapi/tests/test_file_system.cc b/ppapi/tests/test_file_system.cc
index 7758f5f..fe5c902 100644
--- a/ppapi/tests/test_file_system.cc
+++ b/ppapi/tests/test_file_system.cc
@@ -18,12 +18,12 @@ bool TestFileSystem::Init() {
}
void TestFileSystem::RunTest() {
- RUN_TEST(Open);
- RUN_TEST(MultipleOpens);
+ RUN_TEST_FORCEASYNC_AND_NOT(Open);
+ RUN_TEST_FORCEASYNC_AND_NOT(MultipleOpens);
}
std::string TestFileSystem::TestOpen() {
- TestCompletionCallback callback(instance_->pp_instance());
+ TestCompletionCallback callback(instance_->pp_instance(), force_async_);
// Open.
pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
@@ -39,6 +39,8 @@ std::string TestFileSystem::TestOpen() {
.Open(1024, callback);
if (callback.run_count() > 0)
return "FileSystem::Open ran callback synchronously.";
+ if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
+ return ReportError("FileSystem::Open force_async", rv);
if (rv == PP_OK_COMPLETIONPENDING) {
rv = callback.WaitForResult();
if (rv != PP_ERROR_ABORTED)
@@ -53,27 +55,32 @@ std::string TestFileSystem::TestOpen() {
std::string TestFileSystem::TestMultipleOpens() {
// Should not allow multiple opens, no matter the first open has completed or
// not.
- TestCompletionCallback callback_1(instance_->pp_instance());
+ TestCompletionCallback callback_1(instance_->pp_instance(), force_async_);
pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
int32_t rv_1 = file_system.Open(1024, callback_1);
if (callback_1.run_count() > 0)
- return "FileSystem::Open ran callback synchronously.";
+ return "FileSystem::Open1 ran callback synchronously.";
+ if (force_async_ && rv_1 != PP_OK_COMPLETIONPENDING)
+ return ReportError("FileSystem::Open1 force_async", rv_1);
- TestCompletionCallback callback_2(instance_->pp_instance());
+ TestCompletionCallback callback_2(instance_->pp_instance(), force_async_);
int32_t rv_2 = file_system.Open(1024, callback_2);
+ if (force_async_ && rv_2 != PP_OK_COMPLETIONPENDING)
+ return ReportError("FileSystem::Open2 force_async", rv_2);
if (rv_2 == PP_OK_COMPLETIONPENDING || rv_2 == PP_OK)
- return "FileSystem::Open should not allow multiple opens.";
+ return "FileSystem::Open2 should not allow multiple opens.";
if (rv_1 == PP_OK_COMPLETIONPENDING)
rv_1 = callback_1.WaitForResult();
if (rv_1 != PP_OK)
- return ReportError("FileSystem::Open", rv_1);
+ return ReportError("FileSystem::Open1", rv_1);
- TestCompletionCallback callback_3(instance_->pp_instance());
+ TestCompletionCallback callback_3(instance_->pp_instance(), force_async_);
int32_t rv_3 = file_system.Open(1024, callback_3);
+ if (force_async_ && rv_3 != PP_OK_COMPLETIONPENDING)
+ return ReportError("FileSystem::Open3 force_async", rv_3);
if (rv_3 == PP_OK_COMPLETIONPENDING || rv_3 == PP_OK)
- return "FileSystem::Open should not allow multiple opens.";
+ return "FileSystem::Open3 should not allow multiple opens.";
PASS();
}
-