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

Unified Diff: ppapi/tests/test_buffer.cc

Issue 7108051: Implement out-of-process proxy for PPB_Buffer_Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: exclude out-of-process testing for OS_MACOSX, where apparently sandboxing dies at startup. 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_buffer.h ('k') | ppapi/thunk/ppb_buffer_trusted_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_buffer.cc
diff --git a/ppapi/tests/test_buffer.cc b/ppapi/tests/test_buffer.cc
index fddc57336cdab5a4df796b0102512e0b5dc5a624..6fd25695e79df648f3a049802372bdb7f2df90f2 100644
--- a/ppapi/tests/test_buffer.cc
+++ b/ppapi/tests/test_buffer.cc
@@ -23,6 +23,7 @@ void TestBuffer::RunTest() {
instance_->LogTest("InvalidSize", TestInvalidSize());
instance_->LogTest("InitToZero", TestInitToZero());
instance_->LogTest("IsBuffer", TestIsBuffer());
+ instance_->LogTest("BasicLifecyle", TestBasicLifeCycle());
}
std::string TestBuffer::TestInvalidSize() {
@@ -75,3 +76,28 @@ std::string TestBuffer::TestIsBuffer() {
PASS();
}
+std::string TestBuffer::TestBasicLifeCycle() {
+ enum { kBufferSize = 100 };
+
+ pp::Buffer_Dev *buffer = new pp::Buffer_Dev(instance_, kBufferSize);
+ if (buffer->is_null() ||
+ !buffer_interface_->IsBuffer(buffer->pp_resource()) ||
+ buffer->size() != kBufferSize) {
+ return "Error creating buffer (earlier test should have failed)";
+ }
+
+ // Test that the buffer got created & mapped.
+ if (buffer->data() == NULL)
+ return "Failed to Map() buffer";
+
+ // Test that the buffer is writeable.
+ char* data = static_cast<char*>(buffer->data());
+ for (int i = 0; i < kBufferSize; ++i)
+ data[i] = 'X';
+
+ // Implicitly test that destroying the buffer doesn't encounter a fatal error
+ // in Unmap.
+ delete buffer;
+
+ PASS();
+}
« no previous file with comments | « ppapi/tests/test_buffer.h ('k') | ppapi/thunk/ppb_buffer_trusted_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698