| Index: cc/test/mock_compositor_frame_sink_support_client.h | 
| diff --git a/cc/test/mock_compositor_frame_sink_support_client.h b/cc/test/mock_compositor_frame_sink_support_client.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..7a1d62b05ab748386d992cfb33baf6b5fd7d1d39 | 
| --- /dev/null | 
| +++ b/cc/test/mock_compositor_frame_sink_support_client.h | 
| @@ -0,0 +1,64 @@ | 
| +// Copyright 2017 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#ifndef CC_TEST_MOCK_COMPOSITOR_FRAME_SINK_SUPPORT_CLIENT_H_ | 
| +#define CC_TEST_MOCK_COMPOSITOR_FRAME_SINK_SUPPORT_CLIENT_H_ | 
| + | 
| +#include "cc/surfaces/compositor_frame_sink_support.h" | 
| +#include "cc/surfaces/compositor_frame_sink_support_client.h" | 
| +#include "cc/test/compositor_frame_helpers.h" | 
| +#include "testing/gmock/include/gmock/gmock.h" | 
| +#include "testing/gtest/include/gtest/gtest.h" | 
| + | 
| +using testing::Invoke; | 
| +using testing::_; | 
| + | 
| +namespace cc { | 
| +namespace test { | 
| + | 
| +class MockCompositorFrameSinkSupportClient | 
| +    : public CompositorFrameSinkSupportClient { | 
| + public: | 
| +  explicit MockCompositorFrameSinkSupportClient( | 
| +      bool create_surface_during_eviction); | 
| +  ~MockCompositorFrameSinkSupportClient() override; | 
| + | 
| +  void set_support(CompositorFrameSinkSupport* support) { support_ = support; } | 
| + | 
| +  ReturnedResourceArray& last_returned_resources() { | 
| +    return last_returned_resources_; | 
| +  } | 
| + | 
| +  // CompositorFrameSinkSupportClient implementation. | 
| +  MOCK_METHOD1(DidReceiveCompositorFrameAck, | 
| +               void(const ReturnedResourceArray&)); | 
| +  MOCK_METHOD1(OnBeginFrame, void(const BeginFrameArgs&)); | 
| +  MOCK_METHOD1(ReclaimResources, void(const ReturnedResourceArray&)); | 
| +  MOCK_METHOD2(WillDrawSurface, void(const LocalSurfaceId&, const gfx::Rect&)); | 
| + | 
| + private: | 
| +  void ReclaimResourcesInternal(const ReturnedResourceArray& resources) { | 
| +    last_returned_resources_ = resources; | 
| +  } | 
| + | 
| +  void CreateSurfaceDrawCallback(const ReturnedResourceArray& resources) { | 
| +    last_returned_resources_ = resources; | 
| +    LocalSurfaceId new_id(7, base::UnguessableToken::Create()); | 
| +    ASSERT_TRUE(support_); | 
| +    ON_CALL(*this, DidReceiveCompositorFrameAck(_)) | 
| +        .WillByDefault(Invoke( | 
| +            this, | 
| +            &MockCompositorFrameSinkSupportClient::ReclaimResourcesInternal)); | 
| +    support_->SubmitCompositorFrame(new_id, MakeCompositorFrame()); | 
| +    support_->EvictFrame(); | 
| +  } | 
| + | 
| +  ReturnedResourceArray last_returned_resources_; | 
| +  CompositorFrameSinkSupport* support_ = nullptr; | 
| +}; | 
| + | 
| +}  // namespace test | 
| +}  // namespace cc | 
| + | 
| +#endif  // CC_TEST_MOCK_COMPOSITOR_FRAME_SINK_SUPPORT_CLIENT_H_ | 
|  |