OLD | NEW |
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/buffers.h" | 6 #include "media/base/buffers.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 namespace { | 11 namespace { |
12 | 12 |
13 // Simple implementation of Buffer to test base class functionality. | 13 // Simple implementation of Buffer to test base class functionality. |
14 class TestBuffer : public Buffer { | 14 class TestBuffer : public Buffer { |
15 public: | 15 public: |
16 TestBuffer() | 16 TestBuffer() |
17 : Buffer(base::TimeDelta(), base::TimeDelta()) { | 17 : Buffer(base::TimeDelta(), base::TimeDelta()) { |
18 } | 18 } |
19 | 19 |
20 // Sets |data_| and |size_| members for testing purposes. Does not take | 20 // Sets |data_| and |size_| members for testing purposes. Does not take |
21 // ownership of |data|. | 21 // ownership of |data|. |
22 TestBuffer(const uint8* data, int size) | 22 TestBuffer(const uint8* data, int size) |
23 : Buffer(base::TimeDelta(), base::TimeDelta()), | 23 : Buffer(base::TimeDelta(), base::TimeDelta()), |
24 data_(data), | 24 data_(data), |
25 size_(size) { | 25 size_(size) { |
26 } | 26 } |
27 | 27 |
28 virtual ~TestBuffer() {} | |
29 | |
30 // Buffer implementation. | 28 // Buffer implementation. |
31 virtual const uint8* GetData() const OVERRIDE { return data_; } | 29 virtual const uint8* GetData() const OVERRIDE { return data_; } |
32 virtual int GetDataSize() const OVERRIDE { return size_; } | 30 virtual int GetDataSize() const OVERRIDE { return size_; } |
33 | 31 |
| 32 protected: |
| 33 virtual ~TestBuffer() {} |
| 34 |
34 private: | 35 private: |
35 const uint8* data_; | 36 const uint8* data_; |
36 int size_; | 37 int size_; |
37 | 38 |
38 DISALLOW_COPY_AND_ASSIGN(TestBuffer); | 39 DISALLOW_COPY_AND_ASSIGN(TestBuffer); |
39 }; | 40 }; |
40 | 41 |
41 } // namespace | 42 } // namespace |
42 | 43 |
43 TEST(BufferTest, Timestamp) { | 44 TEST(BufferTest, Timestamp) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 buffer = new TestBuffer(kData, kDataSize); | 81 buffer = new TestBuffer(kData, kDataSize); |
81 EXPECT_FALSE(buffer->IsEndOfStream()); | 82 EXPECT_FALSE(buffer->IsEndOfStream()); |
82 } | 83 } |
83 | 84 |
84 TEST(BufferTest, GetDecryptConfig) { | 85 TEST(BufferTest, GetDecryptConfig) { |
85 scoped_refptr<TestBuffer> buffer = new TestBuffer(); | 86 scoped_refptr<TestBuffer> buffer = new TestBuffer(); |
86 EXPECT_FALSE(buffer->GetDecryptConfig()); | 87 EXPECT_FALSE(buffer->GetDecryptConfig()); |
87 } | 88 } |
88 | 89 |
89 } // namespace media | 90 } // namespace media |
OLD | NEW |