| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_VIDEO_CAPTURE_MOCK_STREAM_CLIENT_H_ |
| 6 #define COMPONENTS_VIDEO_CAPTURE_MOCK_STREAM_CLIENT_H_ |
| 7 |
| 8 #include "components/video_capture/public/cpp/stream_client_impl.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 |
| 11 namespace video_capture { |
| 12 |
| 13 class MockStreamClient : public mojom::StreamClient { |
| 14 public: |
| 15 MockStreamClient(); |
| 16 ~MockStreamClient(); |
| 17 |
| 18 // mojom::StreamClient. Use forwarders for move only types, see |
| 19 // https://github.com/google/googletest/issues/395 |
| 20 MOCK_METHOD2(DoFrameAvailable, |
| 21 void(mojom::FrameInfo* info, |
| 22 const FrameAvailableCallback& callback)); |
| 23 void FrameAvailable(mojom::FrameInfoPtr info, |
| 24 const FrameAvailableCallback& callback) override { |
| 25 DoFrameAvailable(info.get(), callback); |
| 26 callback.Run(); |
| 27 } |
| 28 |
| 29 MOCK_METHOD1(DoError, void(const mojo::String& error)); |
| 30 void Error(const mojo::String& error) override { |
| 31 DVLOG(1) << __FUNCTION__; |
| 32 DoError(error); |
| 33 } |
| 34 |
| 35 mojom::StreamClientPtr CreateProxy() { |
| 36 DCHECK(!binding_.is_bound()); |
| 37 mojom::StreamClientPtr le_client = binding_.CreateInterfacePtrAndBind(); |
| 38 DCHECK(binding_.is_bound()); |
| 39 binding_.EnableTestingMode(); |
| 40 return le_client; |
| 41 } |
| 42 |
| 43 private: |
| 44 mojo::Binding<mojom::StreamClient> binding_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(MockStreamClient); |
| 47 }; |
| 48 |
| 49 } // namespace video_capture |
| 50 |
| 51 #endif // COMPONENTS_VIDEO_CAPTURE_MOCK_STREAM_CLIENT_H_ |
| OLD | NEW |