Index: media/capture/service/mock_stream_client.h |
diff --git a/media/capture/service/mock_stream_client.h b/media/capture/service/mock_stream_client.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..87ae3f4e07ad9ab083236b9390cb1e9cad5ac97d |
--- /dev/null |
+++ b/media/capture/service/mock_stream_client.h |
@@ -0,0 +1,44 @@ |
+// Copyright 2016 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 MEDIA_CAPTURE_SERVICE_MOCK_STREAM_CLIENT_H_ |
+#define MEDIA_CAPTURE_SERVICE_MOCK_STREAM_CLIENT_H_ |
+ |
+#include "media/capture/interfaces/video_capture.mojom.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
+ |
+namespace media { |
+ |
+class MockStreamClient : public mojom::StreamClient { |
+ public: |
+ MockStreamClient(); |
+ ~MockStreamClient(); |
+ |
+ // mojom::StreamClient. Use forwarders for move only types, see |
+ // https://github.com/google/googletest/issues/395 |
+ MOCK_METHOD2(DoFrameAvailable, |
+ void(mojom::FrameInfo* info, |
+ const FrameAvailableCallback& callback)); |
+ void FrameAvailable(mojom::FrameInfoPtr info, |
+ const FrameAvailableCallback& callback) override { |
+ DoFrameAvailable(info.get(), callback); |
+ callback.Run(); |
+ } |
+ MOCK_METHOD1(Error, void(const mojo::String& error)); |
+ |
+ mojom::StreamClientPtr CreateProxy() { |
+ DCHECK(!binding_.is_bound()); |
+ return binding_.CreateInterfacePtrAndBind(); |
+ } |
+ |
+ private: |
+ mojo::Binding<mojom::StreamClient> binding_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MockStreamClient); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_CAPTURE_SERVICE_MOCK_STREAM_CLIENT_H_ |