OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/filters/memory_data_source.h" |
| 6 |
| 7 #include <memory> |
| 8 |
5 #include "base/bind.h" | 9 #include "base/bind.h" |
6 #include "base/macros.h" | 10 #include "base/macros.h" |
7 #include "base/memory/scoped_ptr.h" | |
8 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
9 #include "media/filters/memory_data_source.h" | |
10 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
12 | 14 |
13 namespace media { | 15 namespace media { |
14 | 16 |
15 class MemoryDataSourceTest : public ::testing::Test { | 17 class MemoryDataSourceTest : public ::testing::Test { |
16 public: | 18 public: |
17 MemoryDataSourceTest() {} | 19 MemoryDataSourceTest() {} |
18 | 20 |
19 protected: | 21 protected: |
(...skipping 27 matching lines...) Expand all Loading... |
47 EXPECT_GE(size, 0); | 49 EXPECT_GE(size, 0); |
48 return size; | 50 return size; |
49 } | 51 } |
50 | 52 |
51 void Stop() { memory_data_source_->Stop(); } | 53 void Stop() { memory_data_source_->Stop(); } |
52 | 54 |
53 MOCK_METHOD1(ReadCB, void(int size)); | 55 MOCK_METHOD1(ReadCB, void(int size)); |
54 | 56 |
55 private: | 57 private: |
56 std::vector<uint8_t> data_; | 58 std::vector<uint8_t> data_; |
57 scoped_ptr<MemoryDataSource> memory_data_source_; | 59 std::unique_ptr<MemoryDataSource> memory_data_source_; |
58 | 60 |
59 DISALLOW_COPY_AND_ASSIGN(MemoryDataSourceTest); | 61 DISALLOW_COPY_AND_ASSIGN(MemoryDataSourceTest); |
60 }; | 62 }; |
61 | 63 |
62 TEST_F(MemoryDataSourceTest, EmptySource) { | 64 TEST_F(MemoryDataSourceTest, EmptySource) { |
63 Initialize(0); | 65 Initialize(0); |
64 ReadAndExpect(0, 0, 0); | 66 ReadAndExpect(0, 0, 0); |
65 } | 67 } |
66 | 68 |
67 TEST_F(MemoryDataSourceTest, ReadData) { | 69 TEST_F(MemoryDataSourceTest, ReadData) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // ReadData() doesn't affect GetSize(). | 102 // ReadData() doesn't affect GetSize(). |
101 TEST_F(MemoryDataSourceTest, GetSize) { | 103 TEST_F(MemoryDataSourceTest, GetSize) { |
102 Initialize(128); | 104 Initialize(128); |
103 ReadAndExpect(12, 64, 64); | 105 ReadAndExpect(12, 64, 64); |
104 EXPECT_EQ(128u, GetSize()); | 106 EXPECT_EQ(128u, GetSize()); |
105 ReadAndExpect(-7, 64, DataSource::kReadError); | 107 ReadAndExpect(-7, 64, DataSource::kReadError); |
106 EXPECT_EQ(128u, GetSize()); | 108 EXPECT_EQ(128u, GetSize()); |
107 } | 109 } |
108 | 110 |
109 } // namespace media | 111 } // namespace media |
OLD | NEW |