summaryrefslogtreecommitdiffstats
path: root/media/ffmpeg
diff options
context:
space:
mode:
authorwfh <wfh@chromium.org>2015-01-23 06:37:11 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-23 14:37:52 +0000
commit8ec02a10ee3d563034b5a53552b612ad7f15d834 (patch)
tree19e6f784d14fd8cceebba8acb6448c6159cf4f25 /media/ffmpeg
parentc88ac8ef93762b3392ebd61d707aae3255c1e0cb (diff)
downloadchromium_src-8ec02a10ee3d563034b5a53552b612ad7f15d834.zip
chromium_src-8ec02a10ee3d563034b5a53552b612ad7f15d834.tar.gz
chromium_src-8ec02a10ee3d563034b5a53552b612ad7f15d834.tar.bz2
Add allocator shim test to ffmpeg test suite.
This just verifies that the allocator shim is correctly installed on Windows, the rest of the allocator shim tests are in base_unittests and allocator_unittests. This depends on https://codereview.chromium.org/868533003/ and https://gerrit.chromium.org/gerrit/#/c/73563 BUG=450676 TEST=media_unittests Review URL: https://codereview.chromium.org/865113002 Cr-Commit-Position: refs/heads/master@{#312841}
Diffstat (limited to 'media/ffmpeg')
-rw-r--r--media/ffmpeg/ffmpeg_common_unittest.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/media/ffmpeg/ffmpeg_common_unittest.cc b/media/ffmpeg/ffmpeg_common_unittest.cc
index 0d9bdc9..ff07307 100644
--- a/media/ffmpeg/ffmpeg_common_unittest.cc
+++ b/media/ffmpeg/ffmpeg_common_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "media/ffmpeg/ffmpeg_common.h"
#include "media/filters/ffmpeg_glue.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -88,6 +89,17 @@ TEST_F(FFmpegCommonTest, UTCDateToTime_Valid) {
EXPECT_EQ(0, exploded.millisecond);
}
+#if defined(ALLOCATOR_SHIM) && defined(GTEST_HAS_DEATH_TEST)
+TEST_F(FFmpegCommonTest, WinAllocatorShimDeathTest) {
+ scoped_ptr<char, base::FreeDeleter> ptr;
+ // INT_MAX - 128 is carefully chosen to be below the default limit for
+ // ffmpeg allocations, but above the maximum allowed limit by the allocator
+ // shim, so we can be certain the code is being hit.
+ EXPECT_DEATH(ptr.reset(static_cast<char*>(av_malloc(INT_MAX - 128))), "");
+ ASSERT_TRUE(!ptr);
+}
+#endif
+
TEST_F(FFmpegCommonTest, UTCDateToTime_Invalid) {
const char* invalid_date_strings[] = {
"",