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

Unified Diff: media/ffmpeg/ffmpeg_common_unittest.cc

Issue 865113002: Add allocator shim test to ffmpeg test suite. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@allocatorfix1
Patch Set: Created 5 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/ffmpeg/ffmpeg_common_unittest.cc
diff --git a/media/ffmpeg/ffmpeg_common_unittest.cc b/media/ffmpeg/ffmpeg_common_unittest.cc
index 0d9bdc9980f9aa918c5516802efb24b490d30c3d..ff0730732f9ced51c69398c1812ea5bbb5342ba0 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[] = {
"",
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698