Chromium Code Reviews| Index: cc/surfaces/surface_factory_unittest.cc |
| diff --git a/cc/surfaces/surface_factory_unittest.cc b/cc/surfaces/surface_factory_unittest.cc |
| index 9052801e129357f7853013800d528e550999c33d..debf035c1b641b7df8abe3c800619bda0ac4da55 100644 |
| --- a/cc/surfaces/surface_factory_unittest.cc |
| +++ b/cc/surfaces/surface_factory_unittest.cc |
| @@ -16,10 +16,12 @@ |
| #include "cc/output/copy_output_request.h" |
| #include "cc/output/copy_output_result.h" |
| #include "cc/resources/resource_provider.h" |
| +#include "cc/surfaces/framesink_manager_client.h" |
| #include "cc/surfaces/surface.h" |
| #include "cc/surfaces/surface_factory_client.h" |
| #include "cc/surfaces/surface_info.h" |
| #include "cc/surfaces/surface_manager.h" |
| +#include "cc/surfaces/surface_resource_holder_client.h" |
| #include "cc/test/scheduler_test_common.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| #include "ui/gfx/geometry/size.h" |
| @@ -36,19 +38,23 @@ static auto kArbitrarySourceId1 = |
| static auto kArbitrarySourceId2 = |
| base::UnguessableToken::Deserialize(0xdead, 0xbee0); |
| -class TestSurfaceFactoryClient : public SurfaceFactoryClient { |
| +class TestClient : public SurfaceFactoryClient, |
|
danakj
2017/04/21 15:06:48
also suggest splitting this up. It looks like this
Alex Z.
2017/04/21 18:14:36
I created StubSurfaceFactoryClient and FakeSurface
|
| + public SurfaceResourceHolderClient, |
| + public FrameSinkManagerClient { |
| public: |
| - TestSurfaceFactoryClient() : begin_frame_source_(nullptr) {} |
| - ~TestSurfaceFactoryClient() override {} |
| + TestClient() {} |
| + ~TestClient() override {} |
| + |
| + void ReferencedSurfacesChanged( |
| + const LocalSurfaceId& local_surface_id, |
| + const std::vector<SurfaceId>* active_referenced_surfaces) override {} |
| void ReturnResources(const ReturnedResourceArray& resources) override { |
| - returned_resources_.insert( |
| - returned_resources_.end(), resources.begin(), resources.end()); |
| + returned_resources_.insert(returned_resources_.end(), resources.begin(), |
| + resources.end()); |
| } |
| - void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override { |
| - begin_frame_source_ = begin_frame_source; |
| - } |
| + void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {} |
| const ReturnedResourceArray& returned_resources() const { |
| return returned_resources_; |
| @@ -56,13 +62,10 @@ class TestSurfaceFactoryClient : public SurfaceFactoryClient { |
| void clear_returned_resources() { returned_resources_.clear(); } |
| - BeginFrameSource* begin_frame_source() const { return begin_frame_source_; } |
| - |
| private: |
| ReturnedResourceArray returned_resources_; |
| - BeginFrameSource* begin_frame_source_; |
| - DISALLOW_COPY_AND_ASSIGN(TestSurfaceFactoryClient); |
| + DISALLOW_COPY_AND_ASSIGN(TestClient); |
| }; |
| gpu::SyncToken GenTestSyncToken(int id) { |
| @@ -75,8 +78,10 @@ gpu::SyncToken GenTestSyncToken(int id) { |
| class SurfaceFactoryTest : public testing::Test, public SurfaceObserver { |
| public: |
| SurfaceFactoryTest() |
| - : factory_( |
| - new SurfaceFactory(kArbitraryFrameSinkId, &manager_, &client_)), |
| + : factory_(new SurfaceFactory(kArbitraryFrameSinkId, |
| + &manager_, |
| + &client_, |
| + &client_)), |
| local_surface_id_(3, kArbitraryToken), |
| frame_sync_token_(GenTestSyncToken(4)), |
| consumer_sync_token_(GenTestSyncToken(5)) { |
| @@ -157,7 +162,7 @@ class SurfaceFactoryTest : public testing::Test, public SurfaceObserver { |
| protected: |
| SurfaceManager manager_; |
| - TestSurfaceFactoryClient client_; |
| + TestClient client_; |
| std::unique_ptr<SurfaceFactory> factory_; |
| LocalSurfaceId local_surface_id_; |
| SurfaceId last_created_surface_id_; |
| @@ -594,7 +599,7 @@ TEST_F(SurfaceFactoryTest, EvictSurfaceDependencyRegistered) { |
| TEST_F(SurfaceFactoryTest, DestroySequence) { |
| LocalSurfaceId local_surface_id2(5, kArbitraryToken); |
| std::unique_ptr<SurfaceFactory> factory2( |
| - new SurfaceFactory(kArbitraryFrameSinkId, &manager_, &client_)); |
| + new SurfaceFactory(kArbitraryFrameSinkId, &manager_, &client_, &client_)); |
| SurfaceId id2(kArbitraryFrameSinkId, local_surface_id2); |
| factory2->SubmitCompositorFrame(local_surface_id2, CompositorFrame(), |
| SurfaceFactory::DrawCallback(), |
| @@ -654,7 +659,7 @@ TEST_F(SurfaceFactoryTest, DestroyCycle) { |
| LocalSurfaceId local_surface_id2(5, kArbitraryToken); |
| SurfaceId id2(kArbitraryFrameSinkId, local_surface_id2); |
| std::unique_ptr<SurfaceFactory> factory2( |
| - new SurfaceFactory(kArbitraryFrameSinkId, &manager_, &client_)); |
| + new SurfaceFactory(kArbitraryFrameSinkId, &manager_, &client_, &client_)); |
| manager_.RegisterFrameSinkId(kAnotherArbitraryFrameSinkId); |
| // Give id2 a frame that references local_surface_id_. |
| { |