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

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

Issue 1141703002: Chromium changes for static linking ffmpeg (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Roll DEPS to fix cros, rebase. 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"
7 #include "media/ffmpeg/ffmpeg_common.h" 8 #include "media/ffmpeg/ffmpeg_common.h"
8 #include "media/filters/ffmpeg_glue.h" 9 #include "media/filters/ffmpeg_glue.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace media { 12 namespace media {
12 13
13 class FFmpegCommonTest : public testing::Test { 14 class FFmpegCommonTest : public testing::Test {
14 public: 15 public:
15 FFmpegCommonTest() { FFmpegGlue::InitializeFFmpeg(); } 16 FFmpegCommonTest() {
17 FFmpegGlue::InitializeFFmpeg();
18 }
16 ~FFmpegCommonTest() override{}; 19 ~FFmpegCommonTest() override{};
17 }; 20 };
18 21
19 TEST_F(FFmpegCommonTest, OpusAudioDecoderConfig) { 22 TEST_F(FFmpegCommonTest, OpusAudioDecoderConfig) {
20 AVCodecContext context = {0}; 23 AVCodecContext context = {0};
21 context.codec_type = AVMEDIA_TYPE_AUDIO; 24 context.codec_type = AVMEDIA_TYPE_AUDIO;
22 context.codec_id = AV_CODEC_ID_OPUS; 25 context.codec_id = AV_CODEC_ID_OPUS;
23 context.channel_layout = CHANNEL_LAYOUT_STEREO; 26 context.channel_layout = CHANNEL_LAYOUT_STEREO;
24 context.channels = 2; 27 context.channels = 2;
25 context.sample_fmt = AV_SAMPLE_FMT_FLT; 28 context.sample_fmt = AV_SAMPLE_FMT_FLT;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 EXPECT_EQ(2012, exploded.year); 85 EXPECT_EQ(2012, exploded.year);
83 EXPECT_EQ(11, exploded.month); 86 EXPECT_EQ(11, exploded.month);
84 EXPECT_EQ(6, exploded.day_of_week); 87 EXPECT_EQ(6, exploded.day_of_week);
85 EXPECT_EQ(10, exploded.day_of_month); 88 EXPECT_EQ(10, exploded.day_of_month);
86 EXPECT_EQ(12, exploded.hour); 89 EXPECT_EQ(12, exploded.hour);
87 EXPECT_EQ(34, exploded.minute); 90 EXPECT_EQ(34, exploded.minute);
88 EXPECT_EQ(56, exploded.second); 91 EXPECT_EQ(56, exploded.second);
89 EXPECT_EQ(0, exploded.millisecond); 92 EXPECT_EQ(0, exploded.millisecond);
90 } 93 }
91 94
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
103 TEST_F(FFmpegCommonTest, UTCDateToTime_Invalid) { 95 TEST_F(FFmpegCommonTest, UTCDateToTime_Invalid) {
104 const char* invalid_date_strings[] = { 96 const char* invalid_date_strings[] = {
105 "", 97 "",
106 "2012-11-10", 98 "2012-11-10",
107 "12:34:56", 99 "12:34:56",
108 "-- ::", 100 "-- ::",
109 "2012-11-10 12:34:", 101 "2012-11-10 12:34:",
110 "2012-11-10 12::56", 102 "2012-11-10 12::56",
111 "2012-11-10 :34:56", 103 "2012-11-10 :34:56",
112 "2012-11- 12:34:56", 104 "2012-11- 12:34:56",
(...skipping 17 matching lines...) Expand all
130 for (size_t i = 0; i < arraysize(invalid_date_strings); ++i) { 122 for (size_t i = 0; i < arraysize(invalid_date_strings); ++i) {
131 const char* date_string = invalid_date_strings[i]; 123 const char* date_string = invalid_date_strings[i];
132 base::Time result; 124 base::Time result;
133 EXPECT_FALSE(FFmpegUTCDateToTime(date_string, &result)) 125 EXPECT_FALSE(FFmpegUTCDateToTime(date_string, &result))
134 << "date_string '" << date_string << "'"; 126 << "date_string '" << date_string << "'";
135 EXPECT_TRUE(result.is_null()); 127 EXPECT_TRUE(result.is_null());
136 } 128 }
137 } 129 }
138 130
139 } // namespace media 131 } // 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