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

Side by Side Diff: media/base/decoder_buffer_unittest.cc

Issue 11929015: Tighten up media::DecoderBuffer API contract for end of stream buffers (round 2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 10 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/base/decoder_buffer.cc ('k') | media/base/stream_parser_buffer.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) 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 "base/string_util.h" 5 #include "base/string_util.h"
6 #include "media/base/decoder_buffer.h" 6 #include "media/base/decoder_buffer.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace media { 9 namespace media {
10 10
11 TEST(DecoderBufferTest, Constructors) { 11 TEST(DecoderBufferTest, Constructors) {
12 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0)); 12 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0));
13 EXPECT_TRUE(buffer->GetData()); 13 EXPECT_TRUE(buffer->GetData());
14 EXPECT_EQ(0, buffer->GetDataSize()); 14 EXPECT_EQ(0, buffer->GetDataSize());
15 EXPECT_FALSE(buffer->IsEndOfStream()); 15 EXPECT_FALSE(buffer->IsEndOfStream());
16 16
17 const int kTestSize = 10; 17 const int kTestSize = 10;
18 scoped_refptr<DecoderBuffer> buffer3(new DecoderBuffer(kTestSize)); 18 scoped_refptr<DecoderBuffer> buffer3(new DecoderBuffer(kTestSize));
19 ASSERT_TRUE(buffer3); 19 ASSERT_TRUE(buffer3);
20 EXPECT_EQ(kTestSize, buffer3->GetDataSize()); 20 EXPECT_EQ(kTestSize, buffer3->GetDataSize());
21 } 21 }
22 22
23 TEST(DecoderBufferTest, CreateEOSBuffer) { 23 TEST(DecoderBufferTest, CreateEOSBuffer) {
24 scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CreateEOSBuffer()); 24 scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CreateEOSBuffer());
25 EXPECT_TRUE(buffer->IsEndOfStream()); 25 EXPECT_TRUE(buffer->IsEndOfStream());
26 EXPECT_FALSE(buffer->GetData());
27 EXPECT_EQ(0, buffer->GetDataSize());
28 } 26 }
29 27
30 TEST(DecoderBufferTest, CopyFrom) { 28 TEST(DecoderBufferTest, CopyFrom) {
31 const uint8 kData[] = "hello"; 29 const uint8 kData[] = "hello";
32 const int kDataSize = arraysize(kData); 30 const int kDataSize = arraysize(kData);
33 scoped_refptr<DecoderBuffer> buffer2(DecoderBuffer::CopyFrom( 31 scoped_refptr<DecoderBuffer> buffer2(DecoderBuffer::CopyFrom(
34 reinterpret_cast<const uint8*>(&kData), kDataSize)); 32 reinterpret_cast<const uint8*>(&kData), kDataSize));
35 ASSERT_TRUE(buffer2); 33 ASSERT_TRUE(buffer2);
36 EXPECT_NE(kData, buffer2->GetData()); 34 EXPECT_NE(kData, buffer2->GetData());
37 EXPECT_EQ(buffer2->GetDataSize(), kDataSize); 35 EXPECT_EQ(buffer2->GetDataSize(), kDataSize);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 ASSERT_EQ(0, memcmp(read_only_data, kData, kDataSize)); 80 ASSERT_EQ(0, memcmp(read_only_data, kData, kDataSize));
83 EXPECT_FALSE(buffer->IsEndOfStream()); 81 EXPECT_FALSE(buffer->IsEndOfStream());
84 } 82 }
85 83
86 TEST(DecoderBufferTest, GetDecryptConfig) { 84 TEST(DecoderBufferTest, GetDecryptConfig) {
87 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0)); 85 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0));
88 EXPECT_FALSE(buffer->GetDecryptConfig()); 86 EXPECT_FALSE(buffer->GetDecryptConfig());
89 } 87 }
90 88
91 } // namespace media 89 } // namespace media
OLDNEW
« no previous file with comments | « media/base/decoder_buffer.cc ('k') | media/base/stream_parser_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698