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 MEDIA_CAPTURE_SERVICE_MOCK_STREAM_CLIENT_H_ |
| 6 #define MEDIA_CAPTURE_SERVICE_MOCK_STREAM_CLIENT_H_ |
| 7 |
| 8 #include "media/capture/interfaces/video_capture.mojom.h" |
| 9 #include "mojo/public/cpp/bindings/binding.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" |
| 11 |
| 12 namespace media { |
| 13 |
| 14 class MockStreamClient : public mojom::VideoCaptureStreamClient { |
| 15 public: |
| 16 MockStreamClient(); |
| 17 ~MockStreamClient(); |
| 18 |
| 19 // mojom::VideoCaptureStreamClient. Use forwarders for move only types, see |
| 20 // https://github.com/google/googletest/issues/395 |
| 21 MOCK_METHOD2(DoOnFrameAvailable, |
| 22 void(mojom::FrameInfo* info, |
| 23 const OnFrameAvailableCallback& callback)); |
| 24 void OnFrameAvailable(mojom::FrameInfoPtr info, |
| 25 const OnFrameAvailableCallback& callback) override { |
| 26 DoOnFrameAvailable(info.get(), callback); |
| 27 callback.Run(); |
| 28 } |
| 29 MOCK_METHOD1(OnError, void(const mojo::String& error)); |
| 30 |
| 31 mojom::VideoCaptureStreamClientPtr CreateProxy() { |
| 32 DCHECK(!binding_.is_bound()); |
| 33 return binding_.CreateInterfacePtrAndBind(); |
| 34 } |
| 35 |
| 36 private: |
| 37 mojo::Binding<mojom::VideoCaptureStreamClient> binding_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(MockStreamClient); |
| 40 }; |
| 41 |
| 42 } // namespace media |
| 43 |
| 44 #endif // MEDIA_CAPTURE_SERVICE_MOCK_STREAM_CLIENT_H_ |
OLD | NEW |