#include "content/browser/media/capture_handle_manager.h"
#include "content/test/test_render_view_host.h"
#include "content/test/test_web_contents.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace content {
namespace {
Callback;
MediaStreamDevice;
_;
const std::string kLabel = …;
MATCHER(IsNullCaptureHandle, "") { … }
MATCHER_P2(IsCaptureHandle, expected_origin, expected_handle, "") { … }
media::mojom::CaptureHandlePtr MakeCaptureHandle(url::Origin origin,
const std::u16string& handle) { … }
media::mojom::CaptureHandlePtr MakeCaptureHandle(const std::u16string& handle) { … }
blink::mojom::CaptureHandleConfigPtr MakePermissiveConfigWithHandle(
const std::u16string& handle = u"") { … }
blink::mojom::CaptureHandleConfigPtr MakeRestrictiveConfigWithHandle(
const std::vector<url::Origin> permitted_origins,
const std::u16string& handle = u"") { … }
class CallbackHelper { … };
}
class CaptureHandleManagerTest : public RenderViewHostImplTestHarness { … };
TEST_F(CaptureHandleManagerTest,
OnTabCaptureStartedProducesNoCallbackIfDeviceHasNoCaptureHandle) { … }
TEST_F(CaptureHandleManagerTest,
OnTabCaptureStartedProducesCallbackIfDeviceHasOldCaptureHandle) { … }
TEST_F(CaptureHandleManagerTest,
OnTabCaptureStartedProducesCallbackIfDeviceHasNewCaptureHandle) { … }
TEST_F(CaptureHandleManagerTest, CallbackInvokedWhenCaptureHandleChanges) { … }
TEST_F(CaptureHandleManagerTest, CaptureHandleResetByNavigation) { … }
TEST_F(CaptureHandleManagerTest,
CallbackNotInvokedWhenConfigDisallowsCapturer) { … }
TEST_F(CaptureHandleManagerTest, CallbackInvokedWhenConfigAllowsCapturer) { … }
}