#include "content/browser/renderer_host/media/service_video_capture_device_launcher.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/mock_callback.h"
#include "base/threading/thread.h"
#include "content/browser/renderer_host/media/ref_counted_video_source_provider.h"
#include "content/browser/renderer_host/media/service_launched_video_capture_device.h"
#include "content/public/test/browser_task_environment.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "services/video_capture/public/cpp/mock_push_subscription.h"
#include "services/video_capture/public/cpp/mock_video_source.h"
#include "services/video_capture/public/cpp/mock_video_source_provider.h"
#include "services/video_capture/public/mojom/video_frame_handler.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
_;
Invoke;
InvokeWithoutArgs;
namespace content {
static const std::string kStubDeviceId = …;
static const media::VideoCaptureParams kArbitraryParams;
static const base::WeakPtr<media::VideoFrameReceiver> kNullReceiver;
class MockVideoCaptureDeviceLauncherCallbacks
: public VideoCaptureDeviceLauncher::Callbacks { … };
class ServiceVideoCaptureDeviceLauncherTest : public testing::Test { … };
TEST_F(ServiceVideoCaptureDeviceLauncherTest, LaunchingDeviceSucceeds) { … }
TEST_F(ServiceVideoCaptureDeviceLauncherTest,
LaunchingDeviceIsAbortedBeforeServiceRespondsWithSuccess) { … }
TEST_F(ServiceVideoCaptureDeviceLauncherTest,
LaunchingDeviceIsAbortedBeforeServiceRespondsWithNotFound) { … }
TEST_F(ServiceVideoCaptureDeviceLauncherTest,
LaunchingDeviceIsAbortedBeforeServiceRespondsWithNotInitialized) { … }
void ServiceVideoCaptureDeviceLauncherTest::RunLaunchingDeviceIsAbortedTest(
video_capture::mojom::CreatePushSubscriptionResultCodePtr
service_result_code) { … }
TEST_F(ServiceVideoCaptureDeviceLauncherTest,
LaunchingDeviceFailsBecauseDeviceNotFound) { … }
TEST_F(ServiceVideoCaptureDeviceLauncherTest,
LaunchingDeviceFailsBecauseSourceProviderIsUnbound) { … }
TEST_F(ServiceVideoCaptureDeviceLauncherTest,
LaunchingDeviceFailsBecauseConnectionLostWhileLaunching) { … }
TEST_F(ServiceVideoCaptureDeviceLauncherTest,
ConnectionToSubscriptionLostAfterSuccessfulLaunch) { … }
TEST_F(ServiceVideoCaptureDeviceLauncherTest,
ConnectionToSourceLostAfterSuccessfulLaunch) { … }
void ServiceVideoCaptureDeviceLauncherTest::
RunConnectionLostAfterSuccessfulStartTest(
base::OnceClosure close_connection_cb) { … }
}