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

Side by Side Diff: media/ffmpeg/ffmpeg_common_unittest.cc

Issue 1161183003: Revert "Chromium changes to statically link ffmpeg." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.cc ('k') | media/filters/ffmpeg_glue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "media/base/media.h"
8 #include "media/ffmpeg/ffmpeg_common.h" 7 #include "media/ffmpeg/ffmpeg_common.h"
9 #include "media/filters/ffmpeg_glue.h" 8 #include "media/filters/ffmpeg_glue.h"
10 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
11 10
12 namespace media { 11 namespace media {
13 12
14 class FFmpegCommonTest : public testing::Test { 13 class FFmpegCommonTest : public testing::Test {
15 public: 14 public:
16 FFmpegCommonTest() { 15 FFmpegCommonTest() { FFmpegGlue::InitializeFFmpeg(); }
17 FFmpegGlue::InitializeFFmpeg();
18 }
19 ~FFmpegCommonTest() override{}; 16 ~FFmpegCommonTest() override{};
20 }; 17 };
21 18
22 TEST_F(FFmpegCommonTest, OpusAudioDecoderConfig) { 19 TEST_F(FFmpegCommonTest, OpusAudioDecoderConfig) {
23 AVCodecContext context = {0}; 20 AVCodecContext context = {0};
24 context.codec_type = AVMEDIA_TYPE_AUDIO; 21 context.codec_type = AVMEDIA_TYPE_AUDIO;
25 context.codec_id = AV_CODEC_ID_OPUS; 22 context.codec_id = AV_CODEC_ID_OPUS;
26 context.channel_layout = CHANNEL_LAYOUT_STEREO; 23 context.channel_layout = CHANNEL_LAYOUT_STEREO;
27 context.channels = 2; 24 context.channels = 2;
28 context.sample_fmt = AV_SAMPLE_FMT_FLT; 25 context.sample_fmt = AV_SAMPLE_FMT_FLT;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 EXPECT_EQ(2012, exploded.year); 82 EXPECT_EQ(2012, exploded.year);
86 EXPECT_EQ(11, exploded.month); 83 EXPECT_EQ(11, exploded.month);
87 EXPECT_EQ(6, exploded.day_of_week); 84 EXPECT_EQ(6, exploded.day_of_week);
88 EXPECT_EQ(10, exploded.day_of_month); 85 EXPECT_EQ(10, exploded.day_of_month);
89 EXPECT_EQ(12, exploded.hour); 86 EXPECT_EQ(12, exploded.hour);
90 EXPECT_EQ(34, exploded.minute); 87 EXPECT_EQ(34, exploded.minute);
91 EXPECT_EQ(56, exploded.second); 88 EXPECT_EQ(56, exploded.second);
92 EXPECT_EQ(0, exploded.millisecond); 89 EXPECT_EQ(0, exploded.millisecond);
93 } 90 }
94 91
92 #if defined(ALLOCATOR_SHIM) && defined(GTEST_HAS_DEATH_TEST)
93 TEST_F(FFmpegCommonTest, WinAllocatorShimDeathTest) {
94 scoped_ptr<char, base::FreeDeleter> ptr;
95 // INT_MAX - 128 is carefully chosen to be below the default limit for
96 // ffmpeg allocations, but above the maximum allowed limit by the allocator
97 // shim, so we can be certain the code is being hit.
98 EXPECT_DEATH(ptr.reset(static_cast<char*>(av_malloc(INT_MAX - 128))), "");
99 ASSERT_TRUE(!ptr);
100 }
101 #endif
102
95 TEST_F(FFmpegCommonTest, UTCDateToTime_Invalid) { 103 TEST_F(FFmpegCommonTest, UTCDateToTime_Invalid) {
96 const char* invalid_date_strings[] = { 104 const char* invalid_date_strings[] = {
97 "", 105 "",
98 "2012-11-10", 106 "2012-11-10",
99 "12:34:56", 107 "12:34:56",
100 "-- ::", 108 "-- ::",
101 "2012-11-10 12:34:", 109 "2012-11-10 12:34:",
102 "2012-11-10 12::56", 110 "2012-11-10 12::56",
103 "2012-11-10 :34:56", 111 "2012-11-10 :34:56",
104 "2012-11- 12:34:56", 112 "2012-11- 12:34:56",
(...skipping 17 matching lines...) Expand all
122 for (size_t i = 0; i < arraysize(invalid_date_strings); ++i) { 130 for (size_t i = 0; i < arraysize(invalid_date_strings); ++i) {
123 const char* date_string = invalid_date_strings[i]; 131 const char* date_string = invalid_date_strings[i];
124 base::Time result; 132 base::Time result;
125 EXPECT_FALSE(FFmpegUTCDateToTime(date_string, &result)) 133 EXPECT_FALSE(FFmpegUTCDateToTime(date_string, &result))
126 << "date_string '" << date_string << "'"; 134 << "date_string '" << date_string << "'";
127 EXPECT_TRUE(result.is_null()); 135 EXPECT_TRUE(result.is_null());
128 } 136 }
129 } 137 }
130 138
131 } // namespace media 139 } // namespace media
OLDNEW
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.cc ('k') | media/filters/ffmpeg_glue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698