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

Unified Diff: media/filters/chunk_demuxer_unittest.cc

Issue 10823300: Make ChunkDemuxer::SetTimestampOffset take a TimeDelta instead of double (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/filters/chunk_demuxer_unittest.cc
diff --git a/media/filters/chunk_demuxer_unittest.cc b/media/filters/chunk_demuxer_unittest.cc
index d266a8ae12da915c0d534297e19d1b93b56554ae..1cdd51f6a36c40224f0fbe6ba15e14075342ebb3 100644
--- a/media/filters/chunk_demuxer_unittest.cc
+++ b/media/filters/chunk_demuxer_unittest.cc
@@ -77,6 +77,18 @@ MATCHER(IsEndOfStream, "") {
return arg && arg->IsEndOfStream();
}
+// Note: This matcher is needed because of a precision error in 32-bit linux.
+// If 32-bit linux is compiled with -march=pentium4 -msse2 -mfpmath=sse, the
+// precision error goes away. These flags are turned on in Chromium but off in
+// Chrome so that people with older CPUs can run Chrome.
+MATCHER_P(ApproximatelyEquals, timestamp, "") {
+ base::TimeDelta delta = base::TimeDelta::FromMicroseconds(
+ std::abs(timestamp.InMicroseconds() - arg.InMicroseconds()));
+
+ // 5 microseconds is chosen arbitrarily.
+ return delta < base::TimeDelta::FromMicroseconds(5);
+}
+
static void OnReadDone(const base::TimeDelta& expected_time,
bool* called,
DemuxerStream::Status status,
@@ -2320,9 +2332,10 @@ TEST_F(ChunkDemuxerTest, TestDurationChangeTimestampOffset) {
kDefaultDuration().InSecondsF()));
Ami GONE FROM CHROMIUM 2012/08/14 00:05:18 Per offline convo: IWBN if ChunkDemuxer dealt only
scoped_ptr<Cluster> cluster = GenerateCluster(0, 4);
- EXPECT_CALL(host_, SetDuration(
- kDefaultDuration() + base::TimeDelta::FromMilliseconds(
- kAudioBlockDuration * 2)));
+ base::TimeDelta expected_duration = kDefaultDuration() +
+ base::TimeDelta::FromMilliseconds(kAudioBlockDuration * 2);
+
+ EXPECT_CALL(host_, SetDuration(ApproximatelyEquals(expected_duration)));
ASSERT_TRUE(AppendData(cluster->data(), cluster->size()));
}
« 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