| 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 |
| 34 private: | 32 private: |
| 33 virtual ~TestBuffer() {} |
| 34 |
| 35 const uint8* data_; | 35 const uint8* data_; |
| 36 int size_; | 36 int size_; |
| 37 | 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(TestBuffer); | 38 DISALLOW_COPY_AND_ASSIGN(TestBuffer); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 TEST(BufferTest, Timestamp) { | 43 TEST(BufferTest, Timestamp) { |
| 44 const base::TimeDelta kZero; | 44 const base::TimeDelta kZero; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 buffer = new TestBuffer(kData, kDataSize); | 80 buffer = new TestBuffer(kData, kDataSize); |
| 81 EXPECT_FALSE(buffer->IsEndOfStream()); | 81 EXPECT_FALSE(buffer->IsEndOfStream()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 TEST(BufferTest, GetDecryptConfig) { | 84 TEST(BufferTest, GetDecryptConfig) { |
| 85 scoped_refptr<TestBuffer> buffer = new TestBuffer(); | 85 scoped_refptr<TestBuffer> buffer = new TestBuffer(); |
| 86 EXPECT_FALSE(buffer->GetDecryptConfig()); | 86 EXPECT_FALSE(buffer->GetDecryptConfig()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace media | 89 } // namespace media |
| OLD | NEW |