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 <stddef.h> |
5 #include <stdint.h> | 6 #include <stdint.h> |
6 | 7 |
7 #include <cstring> | 8 #include <cstring> |
8 | 9 |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
11 #include "media/cdm/api/content_decryption_module.h" | 12 #include "media/cdm/api/content_decryption_module.h" |
12 #include "media/cdm/cdm_helpers.h" | 13 #include "media/cdm/cdm_helpers.h" |
13 #include "media/mojo/services/mojo_cdm_allocator.h" | 14 #include "media/mojo/services/mojo_cdm_allocator.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
16 | 17 |
17 namespace media { | 18 namespace media { |
18 | 19 |
19 class MojoCdmAllocatorTest : public testing::Test { | 20 class MojoCdmAllocatorTest : public testing::Test { |
20 public: | 21 public: |
21 MojoCdmAllocatorTest() {} | 22 MojoCdmAllocatorTest() {} |
22 ~MojoCdmAllocatorTest() override {} | 23 ~MojoCdmAllocatorTest() override {} |
23 | 24 |
24 protected: | 25 protected: |
25 cdm::Buffer* CreateCdmBuffer(uint32_t capacity) { | 26 cdm::Buffer* CreateCdmBuffer(size_t capacity) { |
26 return allocator_.CreateCdmBuffer(capacity); | 27 return allocator_.CreateCdmBuffer(capacity); |
27 } | 28 } |
28 | 29 |
29 scoped_ptr<VideoFrameImpl> CreateCdmVideoFrame() { | 30 scoped_ptr<VideoFrameImpl> CreateCdmVideoFrame() { |
30 return allocator_.CreateCdmVideoFrame(); | 31 return allocator_.CreateCdmVideoFrame(); |
31 } | 32 } |
32 | 33 |
33 MojoHandle GetHandle(cdm::Buffer* buffer) { | 34 MojoHandle GetHandle(cdm::Buffer* buffer) { |
34 return allocator_.GetHandleForTesting(buffer); | 35 return allocator_.GetHandleForTesting(buffer); |
35 } | 36 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // Check that the buffer is still in use. It will be freed when |frame| | 122 // Check that the buffer is still in use. It will be freed when |frame| |
122 // is destroyed. | 123 // is destroyed. |
123 EXPECT_EQ(0u, GetAvailableBufferCount()); | 124 EXPECT_EQ(0u, GetAvailableBufferCount()); |
124 frame = nullptr; | 125 frame = nullptr; |
125 | 126 |
126 // Check that the buffer is now in the free list. | 127 // Check that the buffer is now in the free list. |
127 EXPECT_EQ(1u, GetAvailableBufferCount()); | 128 EXPECT_EQ(1u, GetAvailableBufferCount()); |
128 } | 129 } |
129 | 130 |
130 } // namespace media | 131 } // namespace media |
OLD | NEW |