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

Unified Diff: ppapi/tests/test_file_system.cc

Issue 6899055: PPAPI: Force async callback invocation option. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months 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_ref.cc ('k') | ppapi/tests/test_graphics_2d.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_file_system.cc
===================================================================
--- ppapi/tests/test_file_system.cc (revision 91178)
+++ ppapi/tests/test_file_system.cc (working copy)
@@ -18,12 +18,12 @@
}
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 @@
.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();
}
-
« no previous file with comments | « ppapi/tests/test_file_ref.cc ('k') | ppapi/tests/test_graphics_2d.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698