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

Unified Diff: media/mp4/offset_byte_queue_unittest.cc

Issue 10823069: Make peeking before the head of OffsetByteQueue a hard error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
« media/mp4/offset_byte_queue.cc ('K') | « media/mp4/offset_byte_queue.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mp4/offset_byte_queue_unittest.cc
diff --git a/media/mp4/offset_byte_queue_unittest.cc b/media/mp4/offset_byte_queue_unittest.cc
index 3a9b133b281a860ac69e1b1a4d4a69591a36057d..ac4a4627379c056eb6710ab5cc8b99ace2a24840 100644
--- a/media/mp4/offset_byte_queue_unittest.cc
+++ b/media/mp4/offset_byte_queue_unittest.cc
@@ -44,14 +44,10 @@ TEST_F(OffsetByteQueueTest, TestSetUp) {
EXPECT_EQ(255, buf[size-1]);
}
-TEST_F(OffsetByteQueueTest, TestPeekAt) {
+TEST_F(OffsetByteQueueTest, PeekAtDeathTest) {
const uint8* buf;
int size;
- queue_->PeekAt(128, &buf, &size);
- EXPECT_EQ(NULL, buf);
- EXPECT_EQ(0, size);
-
queue_->PeekAt(400, &buf, &size);
EXPECT_EQ(queue_->tail() - 400, size);
EXPECT_EQ(400 - 256, buf[0]);
@@ -59,6 +55,9 @@ TEST_F(OffsetByteQueueTest, TestPeekAt) {
queue_->PeekAt(512, &buf, &size);
EXPECT_EQ(NULL, buf);
EXPECT_EQ(0, size);
+
+ // Peeking before current head should be an error
+ ASSERT_DEATH(queue_->PeekAt(128, &buf, &size), "offset >= head");
acolwell GONE FROM CHROMIUM 2012/07/31 19:27:44 Remove this since you said this situation only hap
}
TEST_F(OffsetByteQueueTest, TestTrim) {
« media/mp4/offset_byte_queue.cc ('K') | « media/mp4/offset_byte_queue.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698