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/gpu/avda_codec_allocator.h" | 5 #include "media/gpu/avda_codec_allocator.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 if (about_to_wait_event) | 35 if (about_to_wait_event) |
36 about_to_wait_event->Signal(); | 36 about_to_wait_event->Signal(); |
37 wait_event->Wait(); | 37 wait_event->Wait(); |
38 } | 38 } |
39 | 39 |
40 void SignalImmediately(base::WaitableEvent* event) { | 40 void SignalImmediately(base::WaitableEvent* event) { |
41 event->Signal(); | 41 event->Signal(); |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 class MockClient : public AVDACodecAllocatorClient { | 45 class MockClient : public AVDACodecAllocatorClient, |
| 46 public AVDASurfaceAllocatorClient { |
46 public: | 47 public: |
47 MOCK_METHOD1(OnSurfaceAvailable, void(bool success)); | 48 MOCK_METHOD1(OnSurfaceAvailable, void(bool success)); |
48 MOCK_METHOD0(OnSurfaceDestroyed, void()); | 49 MOCK_METHOD0(OnSurfaceDestroyed, void()); |
49 | 50 |
50 // Gmock doesn't let us mock methods taking move-only types. | 51 // Gmock doesn't let us mock methods taking move-only types. |
51 MOCK_METHOD1(OnCodecConfiguredMock, void(VideoCodecBridge* media_codec)); | 52 MOCK_METHOD1(OnCodecConfiguredMock, void(VideoCodecBridge* media_codec)); |
52 void OnCodecConfigured( | 53 void OnCodecConfigured( |
| 54 scoped_refptr<CodecConfig> codec_config, |
53 std::unique_ptr<VideoCodecBridge> media_codec) override { | 55 std::unique_ptr<VideoCodecBridge> media_codec) override { |
54 OnCodecConfiguredMock(media_codec.get()); | 56 OnCodecConfiguredMock(media_codec.get()); |
55 } | 57 } |
56 }; | 58 }; |
57 | 59 |
58 class AVDACodecAllocatorTest : public testing::Test { | 60 class AVDACodecAllocatorTest : public testing::Test { |
59 public: | 61 public: |
60 AVDACodecAllocatorTest() | 62 AVDACodecAllocatorTest() |
61 : allocator_thread_("AllocatorThread"), | 63 : allocator_thread_("AllocatorThread"), |
62 stop_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 64 stop_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 301 |
300 TEST_F(AVDACodecAllocatorTest, DeallocatingIsSafeDuringSurfaceDestroyed) { | 302 TEST_F(AVDACodecAllocatorTest, DeallocatingIsSafeDuringSurfaceDestroyed) { |
301 allocator2_->AllocateSurface(avda1_, 1); | 303 allocator2_->AllocateSurface(avda1_, 1); |
302 EXPECT_CALL(*avda1_, OnSurfaceDestroyed()).WillOnce(Invoke([=]() { | 304 EXPECT_CALL(*avda1_, OnSurfaceDestroyed()).WillOnce(Invoke([=]() { |
303 allocator2_->DeallocateSurface(avda1_, 1); | 305 allocator2_->DeallocateSurface(avda1_, 1); |
304 })); | 306 })); |
305 allocator2_->OnSurfaceDestroyed(1); | 307 allocator2_->OnSurfaceDestroyed(1); |
306 } | 308 } |
307 | 309 |
308 } // namespace media | 310 } // namespace media |
OLD | NEW |