Chromium Code Reviews| Index: cc/surfaces/surface_manager_ref_unittest.cc |
| diff --git a/cc/surfaces/surface_manager_ref_unittest.cc b/cc/surfaces/surface_manager_ref_unittest.cc |
| index 2b797c710710b638eeeb5942ef77d841671a93f6..66eda03b4ed9eaa25eba032cec9cc7e53e5d141b 100644 |
| --- a/cc/surfaces/surface_manager_ref_unittest.cc |
| +++ b/cc/surfaces/surface_manager_ref_unittest.cc |
| @@ -10,11 +10,11 @@ |
| #include "base/memory/ptr_util.h" |
| #include "cc/surfaces/surface.h" |
| #include "cc/surfaces/surface_factory.h" |
| +#include "cc/surfaces/surface_factory_client.h" |
| #include "cc/surfaces/surface_id.h" |
| #include "cc/surfaces/surface_manager.h" |
| #include "cc/surfaces/surface_sequence_generator.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| - |
| namespace cc { |
| namespace { |
| @@ -24,6 +24,12 @@ constexpr FrameSinkId kFrameSink3(3, 0); |
| const LocalFrameId kLocalFrame1(1, base::UnguessableToken::Create()); |
| const LocalFrameId kLocalFrame2(2, base::UnguessableToken::Create()); |
| +class EmptySurfaceFactoryClient : public SurfaceFactoryClient { |
|
danakj
2016/11/12 00:27:22
Stub is the word for this, rather than Empty
Saman Sami
2016/11/14 23:39:01
Done.
|
| + public: |
| + void ReturnResources(const ReturnedResourceArray& resources) override {} |
| + void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {} |
| +}; |
| + |
| // Tests for reference tracking in SurfaceManager. |
| class SurfaceManagerRefTest : public testing::Test { |
| public: |
| @@ -33,13 +39,15 @@ class SurfaceManagerRefTest : public testing::Test { |
| // SurfaceFactory for |frame_sink_id| if necessary. |
| SurfaceId CreateSurface(const FrameSinkId& frame_sink_id, |
| const LocalFrameId& local_frame_id) { |
| - GetFactory(frame_sink_id).Create(local_frame_id); |
| + GetFactory(frame_sink_id) |
| + .SubmitCompositorFrame(local_frame_id, CompositorFrame(), |
| + SurfaceFactory::DrawCallback()); |
| return SurfaceId(frame_sink_id, local_frame_id); |
| } |
| // Destroy Surface with |surface_id|. |
| void DestroySurface(const SurfaceId& surface_id) { |
| - GetFactory(surface_id.frame_sink_id()).Destroy(surface_id.local_frame_id()); |
| + GetFactory(surface_id.frame_sink_id()).EvictFrame(); |
| } |
| protected: |
| @@ -47,7 +55,7 @@ class SurfaceManagerRefTest : public testing::Test { |
| auto& factory_ptr = factories_[frame_sink_id]; |
| if (!factory_ptr) |
| factory_ptr = base::MakeUnique<SurfaceFactory>(frame_sink_id, |
| - manager_.get(), nullptr); |
| + manager_.get(), &client_); |
| return *factory_ptr; |
| } |
| @@ -66,6 +74,7 @@ class SurfaceManagerRefTest : public testing::Test { |
| FrameSinkIdHash> |
| factories_; |
| std::unique_ptr<SurfaceManager> manager_; |
| + EmptySurfaceFactoryClient client_; |
| }; |
| } // namespace |