diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 19:28:41 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 19:28:41 +0000 |
commit | 81fc59f761888440ef190cc5c35a2a1d06986183 (patch) | |
tree | efefe7e18d0caa39f2fb264e1f743f0a19bd951e /ppapi/tests/test_buffer.cc | |
parent | 790e6bed92413c0e8cafb42a97a75a2b3e759486 (diff) | |
download | chromium_src-81fc59f761888440ef190cc5c35a2a1d06986183.zip chromium_src-81fc59f761888440ef190cc5c35a2a1d06986183.tar.gz chromium_src-81fc59f761888440ef190cc5c35a2a1d06986183.tar.bz2 |
Add proper support for copy-constructed pp::Buffer_Dev's.
This requires refcounting Map() to make sure that Unmap() is called once per
underlying SharedMemory.
BUG=85629
TEST=trybots, ui_tests:*PPAPI.Buffer
Review URL: http://codereview.chromium.org/7146007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89044 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests/test_buffer.cc')
-rw-r--r-- | ppapi/tests/test_buffer.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ppapi/tests/test_buffer.cc b/ppapi/tests/test_buffer.cc index 109b8a6..b44047b 100644 --- a/ppapi/tests/test_buffer.cc +++ b/ppapi/tests/test_buffer.cc @@ -95,9 +95,20 @@ std::string TestBuffer::TestBasicLifeCycle() { for (int i = 0; i < kBufferSize; ++i) data[i] = 'X'; + // Implicitly test that the copy constructor doesn't cause a double-unmap on + // delete. + pp::Buffer_Dev* copy = new pp::Buffer_Dev(*buffer); + // Implicitly test that destroying the buffer doesn't encounter a fatal error // in Unmap. delete buffer; + // Test that we can still write to copy's copy of the data. + char* copy_data = static_cast<char*>(copy->data()); + for (int i = 0; i < kBufferSize; ++i) + copy_data[i] = 'Y'; + + delete copy; + PASS(); } |