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

Side by Side 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: Remove death test 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/mp4/offset_byte_queue.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string.h> 5 #include <string.h>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "media/mp4/offset_byte_queue.h" 9 #include "media/mp4/offset_byte_queue.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 30 matching lines...) Expand all
41 queue_->Peek(&buf, &size); 41 queue_->Peek(&buf, &size);
42 EXPECT_EQ(128, size); 42 EXPECT_EQ(128, size);
43 EXPECT_EQ(128, buf[0]); 43 EXPECT_EQ(128, buf[0]);
44 EXPECT_EQ(255, buf[size-1]); 44 EXPECT_EQ(255, buf[size-1]);
45 } 45 }
46 46
47 TEST_F(OffsetByteQueueTest, TestPeekAt) { 47 TEST_F(OffsetByteQueueTest, TestPeekAt) {
48 const uint8* buf; 48 const uint8* buf;
49 int size; 49 int size;
50 50
51 queue_->PeekAt(128, &buf, &size);
52 EXPECT_EQ(NULL, buf);
53 EXPECT_EQ(0, size);
54
55 queue_->PeekAt(400, &buf, &size); 51 queue_->PeekAt(400, &buf, &size);
56 EXPECT_EQ(queue_->tail() - 400, size); 52 EXPECT_EQ(queue_->tail() - 400, size);
57 EXPECT_EQ(400 - 256, buf[0]); 53 EXPECT_EQ(400 - 256, buf[0]);
58 54
59 queue_->PeekAt(512, &buf, &size); 55 queue_->PeekAt(512, &buf, &size);
60 EXPECT_EQ(NULL, buf); 56 EXPECT_EQ(NULL, buf);
61 EXPECT_EQ(0, size); 57 EXPECT_EQ(0, size);
62 } 58 }
63 59
64 TEST_F(OffsetByteQueueTest, TestTrim) { 60 TEST_F(OffsetByteQueueTest, TestTrim) {
(...skipping 22 matching lines...) Expand all
87 // Trimming past the end of the buffer should return 'false'; we haven't seen 83 // Trimming past the end of the buffer should return 'false'; we haven't seen
88 // the preceeding bytes. 84 // the preceeding bytes.
89 EXPECT_FALSE(queue_->Trim(513)); 85 EXPECT_FALSE(queue_->Trim(513));
90 86
91 // However, doing that shouldn't affect the EOS case. Only adding new data 87 // However, doing that shouldn't affect the EOS case. Only adding new data
92 // should alter this behavior. 88 // should alter this behavior.
93 EXPECT_TRUE(queue_->Trim(512)); 89 EXPECT_TRUE(queue_->Trim(512));
94 } 90 }
95 91
96 } // namespace media 92 } // namespace media
OLDNEW
« no previous file with comments | « media/mp4/offset_byte_queue.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698