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

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

Issue 236023003: Add WebMediaPlayer::timelineOffset() support to WebMediaPlayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address CR comments Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/chunk_demuxer.h » ('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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "media/base/media.h" 8 #include "media/base/media.h"
9 #include "media/ffmpeg/ffmpeg_common.h" 9 #include "media/ffmpeg/ffmpeg_common.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 // Have FFMpeg compute the size of a buffer of 1 channel / 1 frame 92 // Have FFMpeg compute the size of a buffer of 1 channel / 1 frame
93 // with 1 byte alignment to make sure the sizes match. 93 // with 1 byte alignment to make sure the sizes match.
94 int single_buffer_size = av_samples_get_buffer_size(NULL, 1, 1, format, 1); 94 int single_buffer_size = av_samples_get_buffer_size(NULL, 1, 1, format, 1);
95 int bytes_per_channel = SampleFormatToBytesPerChannel(sample_format); 95 int bytes_per_channel = SampleFormatToBytesPerChannel(sample_format);
96 EXPECT_EQ(bytes_per_channel, single_buffer_size); 96 EXPECT_EQ(bytes_per_channel, single_buffer_size);
97 } 97 }
98 } 98 }
99 99
100 TEST_F(FFmpegCommonTest, UTCDateToTime_Valid) {
101 base::Time result;
102 EXPECT_TRUE(FFmpegUTCDateToTime("2012-11-10 12:34:56", &result));
103
104 base::Time::Exploded exploded;
105 result.UTCExplode(&exploded);
106 EXPECT_TRUE(exploded.HasValidValues());
107 EXPECT_EQ(2012, exploded.year);
108 EXPECT_EQ(11, exploded.month);
109 EXPECT_EQ(6, exploded.day_of_week);
110 EXPECT_EQ(10, exploded.day_of_month);
111 EXPECT_EQ(12, exploded.hour);
112 EXPECT_EQ(34, exploded.minute);
113 EXPECT_EQ(56, exploded.second);
114 EXPECT_EQ(0, exploded.millisecond);
115 }
116
117 TEST_F(FFmpegCommonTest, UTCDateToTime_Invalid) {
118 const char* invalid_date_strings[] = {
119 "",
120 "2012-11-10",
121 "12:34:56",
122 "-- ::",
123 "2012-11-10 12:34:",
124 "2012-11-10 12::56",
125 "2012-11-10 :34:56",
126 "2012-11- 12:34:56",
127 "2012--10 12:34:56",
128 "-11-10 12:34:56",
129 "2012-11 12:34:56",
130 "2012-11-10-12 12:34:56",
131 "2012-11-10 12:34",
132 "2012-11-10 12:34:56:78",
133 "ABCD-11-10 12:34:56",
134 "2012-EF-10 12:34:56",
135 "2012-11-GH 12:34:56",
136 "2012-11-10 IJ:34:56",
137 "2012-11-10 12:JL:56",
138 "2012-11-10 12:34:MN",
139 "2012-11-10 12:34:56.123",
140 "2012-11-1012:34:56",
141 "2012-11-10 12:34:56 UTC",
142 };
143
144 for (size_t i = 0; i < arraysize(invalid_date_strings); ++i) {
145 const char* date_string = invalid_date_strings[i];
146 base::Time result;
147 EXPECT_FALSE(FFmpegUTCDateToTime(date_string, &result))
148 << "date_string '" << date_string << "'";
149 EXPECT_TRUE(result.is_null());
150 }
151 }
152
153
100 } // namespace media 154 } // namespace media
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698