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(MediaCodecBridge* media_codec)); | 52 MOCK_METHOD1(OnCodecConfiguredMock, void(MediaCodecBridge* media_codec)); |
52 void OnCodecConfigured( | 53 void OnCodecConfigured( |
53 std::unique_ptr<MediaCodecBridge> media_codec) override { | 54 std::unique_ptr<MediaCodecBridge> media_codec) override { |
54 OnCodecConfiguredMock(media_codec.get()); | 55 OnCodecConfiguredMock(media_codec.get()); |
55 } | 56 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 300 |
300 TEST_F(AVDACodecAllocatorTest, DeallocatingIsSafeDuringSurfaceDestroyed) { | 301 TEST_F(AVDACodecAllocatorTest, DeallocatingIsSafeDuringSurfaceDestroyed) { |
301 allocator2_->AllocateSurface(avda1_, 1); | 302 allocator2_->AllocateSurface(avda1_, 1); |
302 EXPECT_CALL(*avda1_, OnSurfaceDestroyed()).WillOnce(Invoke([=]() { | 303 EXPECT_CALL(*avda1_, OnSurfaceDestroyed()).WillOnce(Invoke([=]() { |
303 allocator2_->DeallocateSurface(avda1_, 1); | 304 allocator2_->DeallocateSurface(avda1_, 1); |
304 })); | 305 })); |
305 allocator2_->OnSurfaceDestroyed(1); | 306 allocator2_->OnSurfaceDestroyed(1); |
306 } | 307 } |
307 | 308 |
308 } // namespace media | 309 } // namespace media |
OLD | NEW |