| Index: ppapi/tests/test_file_system.cc
|
| ===================================================================
|
| --- ppapi/tests/test_file_system.cc (revision 90603)
|
| +++ ppapi/tests/test_file_system.cc (working copy)
|
| @@ -18,12 +18,12 @@
|
| }
|
|
|
| void TestFileSystem::RunTest() {
|
| - RUN_TEST(Open);
|
| - RUN_TEST(MultipleOpens);
|
| + RUN_ASYNC_TEST(Open);
|
| + RUN_ASYNC_TEST(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 @@
|
| .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::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();
|
| }
|
| -
|
|
|