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

Unified Diff: ppapi/tests/test_file_io.cc

Issue 15864005: Add a PPAPI browser tests for an issue of NaCl crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add issue number to comment Created 7 years, 7 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_io.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_file_io.cc
diff --git a/ppapi/tests/test_file_io.cc b/ppapi/tests/test_file_io.cc
index 620344e834e58c5ce69331f508dc8d5db20b22e2..50064192a43ca97e10d0031b01fe1b1327c10a6c 100644
--- a/ppapi/tests/test_file_io.cc
+++ b/ppapi/tests/test_file_io.cc
@@ -184,6 +184,7 @@ void TestFileIO::RunTests(const std::string& filter) {
RUN_CALLBACK_TEST(TestFileIO, NotAllowMixedReadWrite, filter);
RUN_CALLBACK_TEST(TestFileIO, WillWriteWillSetLength, filter);
RUN_CALLBACK_TEST(TestFileIO, RequestOSFileHandle, filter);
+ RUN_CALLBACK_TEST(TestFileIO, RequestOSFileHandleWithOpenExclusive, filter);
RUN_CALLBACK_TEST(TestFileIO, Mmap, filter);
// TODO(viettrungluu): add tests:
@@ -1108,6 +1109,39 @@ std::string TestFileIO::TestRequestOSFileHandle() {
PASS();
}
+// Calling RequestOSFileHandle with the FileIO that is opened with
+// PP_FILEOPENFLAG_EXCLUSIVE used to cause NaCl module to crash while loading.
+// This is a regression test for crbug.com/243241.
+std::string TestFileIO::TestRequestOSFileHandleWithOpenExclusive() {
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+
+ pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
+ pp::FileRef file_ref(file_system, "/file_os_fd2");
+
+ callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
+ ASSERT_EQ(PP_OK, callback.result());
+
+ pp::FileIO_Private file_io(instance_);
+ callback.WaitForResult(file_io.Open(file_ref,
+ PP_FILEOPENFLAG_CREATE |
+ PP_FILEOPENFLAG_READ |
+ PP_FILEOPENFLAG_WRITE |
+ PP_FILEOPENFLAG_EXCLUSIVE,
+ callback.GetCallback()));
+ ASSERT_EQ(PP_OK, callback.result());
+
+ TestCompletionCallbackWithOutput<pp::PassFileHandle> output_callback(
+ instance_->pp_instance(), callback_type());
+ output_callback.WaitForResult(
+ file_io.RequestOSFileHandle(output_callback.GetCallback()));
+ PP_FileHandle handle = output_callback.output().Release();
+ if (handle == PP_kInvalidFileHandle)
+ return "FileIO::RequestOSFileHandle() returned a bad file handle.";
+ ASSERT_EQ(PP_OK, output_callback.result());
+
+ PASS();
+}
+
std::string TestFileIO::TestMmap() {
#if !defined(PPAPI_OS_WIN)
TestCompletionCallback callback(instance_->pp_instance(), callback_type());
« no previous file with comments | « ppapi/tests/test_file_io.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698