| Index: components/video_capture/mock_stream_client.h
|
| diff --git a/components/video_capture/mock_stream_client.h b/components/video_capture/mock_stream_client.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..184f2968b44c8b5314281da05f3ceb4c8bdc27f3
|
| --- /dev/null
|
| +++ b/components/video_capture/mock_stream_client.h
|
| @@ -0,0 +1,51 @@
|
| +// 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 COMPONENTS_VIDEO_CAPTURE_MOCK_STREAM_CLIENT_H_
|
| +#define COMPONENTS_VIDEO_CAPTURE_MOCK_STREAM_CLIENT_H_
|
| +
|
| +#include "components/video_capture/public/cpp/stream_client_impl.h"
|
| +#include "testing/gmock/include/gmock/gmock.h"
|
| +
|
| +namespace video_capture {
|
| +
|
| +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(DoError, void(const mojo::String& error));
|
| + void Error(const mojo::String& error) override {
|
| + DVLOG(1) << __FUNCTION__;
|
| + DoError(error);
|
| + }
|
| +
|
| +mojom::StreamClientPtr CreateProxy() {
|
| + DCHECK(!binding_.is_bound());
|
| + mojom::StreamClientPtr le_client = binding_.CreateInterfacePtrAndBind();
|
| + DCHECK(binding_.is_bound());
|
| + binding_.EnableTestingMode();
|
| + return le_client;
|
| + }
|
| +
|
| + private:
|
| + mojo::Binding<mojom::StreamClient> binding_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MockStreamClient);
|
| +};
|
| +
|
| +} // namespace video_capture
|
| +
|
| +#endif // COMPONENTS_VIDEO_CAPTURE_MOCK_STREAM_CLIENT_H_
|
|
|