| 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 30 matching lines...) Expand all Loading... |
| 41 event->Signal(); | 41 event->Signal(); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 class MockClient : public AVDACodecAllocatorClient { | 45 class MockClient : public AVDACodecAllocatorClient { |
| 46 public: | 46 public: |
| 47 MOCK_METHOD1(OnSurfaceAvailable, void(bool success)); | 47 MOCK_METHOD1(OnSurfaceAvailable, void(bool success)); |
| 48 MOCK_METHOD0(OnSurfaceDestroyed, void()); | 48 MOCK_METHOD0(OnSurfaceDestroyed, void()); |
| 49 | 49 |
| 50 // Gmock doesn't let us mock methods taking move-only types. | 50 // Gmock doesn't let us mock methods taking move-only types. |
| 51 MOCK_METHOD1(OnCodecConfiguredMock, void(VideoCodecBridge* media_codec)); | 51 MOCK_METHOD1(OnCodecConfiguredMock, void(MediaCodecBridge* media_codec)); |
| 52 void OnCodecConfigured( | 52 void OnCodecConfigured( |
| 53 std::unique_ptr<VideoCodecBridge> media_codec) override { | 53 std::unique_ptr<MediaCodecBridge> media_codec) override { |
| 54 OnCodecConfiguredMock(media_codec.get()); | 54 OnCodecConfiguredMock(media_codec.get()); |
| 55 } | 55 } |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 class AVDACodecAllocatorTest : public testing::Test { | 58 class AVDACodecAllocatorTest : public testing::Test { |
| 59 public: | 59 public: |
| 60 AVDACodecAllocatorTest() | 60 AVDACodecAllocatorTest() |
| 61 : allocator_thread_("AllocatorThread"), | 61 : allocator_thread_("AllocatorThread"), |
| 62 stop_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 62 stop_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 63 base::WaitableEvent::InitialState::NOT_SIGNALED) { | 63 base::WaitableEvent::InitialState::NOT_SIGNALED) { |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 TEST_F(AVDACodecAllocatorTest, DeallocatingIsSafeDuringSurfaceDestroyed) { | 300 TEST_F(AVDACodecAllocatorTest, DeallocatingIsSafeDuringSurfaceDestroyed) { |
| 301 allocator2_->AllocateSurface(avda1_, 1); | 301 allocator2_->AllocateSurface(avda1_, 1); |
| 302 EXPECT_CALL(*avda1_, OnSurfaceDestroyed()).WillOnce(Invoke([=]() { | 302 EXPECT_CALL(*avda1_, OnSurfaceDestroyed()).WillOnce(Invoke([=]() { |
| 303 allocator2_->DeallocateSurface(avda1_, 1); | 303 allocator2_->DeallocateSurface(avda1_, 1); |
| 304 })); | 304 })); |
| 305 allocator2_->OnSurfaceDestroyed(1); | 305 allocator2_->OnSurfaceDestroyed(1); |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace media | 308 } // namespace media |
| OLD | NEW |