chromium/content/browser/media/capture/web_contents_frame_tracker_unittest.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/media/capture/web_contents_frame_tracker.h"

#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "content/browser/media/capture/mouse_cursor_overlay_controller.h"
#include "content/browser/media/capture/web_contents_video_capture_device.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_utils.h"
#include "content/test/test_render_view_host.h"
#include "content/test/test_web_contents.h"
#include "media/base/media_switches.h"
#include "media/capture/mojom/video_capture_types.mojom.h"
#include "media/capture/video/video_capture_feedback.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/display/screen_info.h"

namespace content {
namespace {

_;
Invoke;
NiceMock;
StrictMock;

constexpr viz::FrameSinkId kInitSinkId(123, 456);

// Standardized screen resolutions to test common scenarios.
constexpr gfx::Size kSizeZero{};
constexpr gfx::Size kSize720p{};
constexpr gfx::Size kSize1080p{};
constexpr gfx::Size kSizeWsxgaPlus{};

class SimpleContext : public WebContentsFrameTracker::Context {};

// The capture device is mostly for interacting with the frame tracker. We do
// care about the frame tracker pushing back target updates, however.
class MockCaptureDevice : public WebContentsVideoCaptureDevice {};

// This test class is intentionally quite similar to
// |WebContentsVideoCaptureDevice|, and provides convenience methods for calling
// into the |WebContentsFrameTracker|, which interacts with UI thread objects
// and needs to be called carefully on the UI thread.
class WebContentsFrameTrackerTest : public RenderViewHostTestHarness {};

TEST_F(WebContentsFrameTrackerTest, CalculatesPreferredSizeClampsToView) {}

TEST_F(WebContentsFrameTrackerTest,
       CalculatesPreferredSizeNoLargerThanCaptureSize) {}

TEST_F(WebContentsFrameTrackerTest,
       CalculatesPreferredSizeWithCorrectAspectRatio) {}

TEST_F(WebContentsFrameTrackerTest,
       CalculatesPreferredSizeAspectRatioWithNoOffByOneErrors) {}

TEST_F(WebContentsFrameTrackerTest,
       CalculatesPreferredSizeLeavesCaptureSizeIfSmallerThanScreen) {}

TEST_F(WebContentsFrameTrackerTest,
       CalculatesPreferredSizeWithZeroValueProperly) {}

TEST_F(WebContentsFrameTrackerTest, UpdatesPreferredSizeOnWebContents) {}

TEST_F(WebContentsFrameTrackerTest, NotifiesOfLostTargets) {}

// We test target changing for all other tests as part of set up, but also
// test the observer callbacks here.
TEST_F(WebContentsFrameTrackerTest, NotifiesOfTargetChanges) {}

TEST_F(WebContentsFrameTrackerTest,
       CroppingChangesTargetParametersAndInvokesCallback) {}

TEST_F(WebContentsFrameTrackerTest, SetsScaleOverride) {}

TEST_F(WebContentsFrameTrackerTest, SettingScaleFactorMaintainsStableCapture) {}

TEST_F(WebContentsFrameTrackerTest, HighDpiIsRoundedIfBetweenBounds) {}

TEST_F(WebContentsFrameTrackerTest, HighDpiIsRoundedIfBetweenDifferentBounds) {}

TEST_F(WebContentsFrameTrackerTest, HighDpiIsRoundedToMinimum) {}

TEST_F(WebContentsFrameTrackerTest, HighDpiIsRoundedToMaximum) {}

TEST_F(WebContentsFrameTrackerTest, HighDpiScalingIsStable) {}

TEST_F(WebContentsFrameTrackerTest, HighDpiAdjustsForResourceUtilization) {}

TEST_F(WebContentsFrameTrackerTest, HighDpiAdjustsForMaxPixelRate) {}

}  // namespace
}  // namespace content