chromium/media/capture/content/capture_resolution_chooser_unittest.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "media/capture/content/capture_resolution_chooser.h"

#include <stddef.h>

#include <numeric>

#include "base/location.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"

Location;

namespace media {

namespace {

// 16:9 maximum and minimum frame sizes.
constexpr int kMaxFrameWidth =;
constexpr int kMaxFrameHeight =;
constexpr int kMinFrameWidth =;
constexpr int kMinFrameHeight =;

// Smallest non-empty size for I420 video.
constexpr int kSmallestNonEmptyWidth =;
constexpr int kSmallestNonEmptyHeight =;

// Checks whether |size| is strictly between (inclusive) |min_size| and
// |max_size| and has the same aspect ratio as |max_size|.
void ExpectIsWithinBoundsAndSameAspectRatio(const Location& location,
                                            const gfx::Size& min_size,
                                            const gfx::Size& max_size,
                                            const gfx::Size& size) {}

// Test that the correct snapped frame sizes are computed for a |chooser|
// configured with either of the variable-resolution change policies, and are
// correctly found when searched.
void TestSnappedFrameSizes(CaptureResolutionChooser* chooser,
                           const gfx::Size& smallest_size) {}

// Test that setting the target frame area results in the correct capture sizes
// being computed for a |chooser| configured with either of the
// variable-resolution change policies.
void TestTargetedFrameAreas(CaptureResolutionChooser* chooser,
                            const gfx::Size& smallest_size) {}

// Determines that there is only one snapped frame size by implication: This
// function searches for the nearest/larger/smaller frame sizes around
// |the_one_size| and checks that there is only ever one result.
void ExpectOnlyOneSnappedFrameSize(const CaptureResolutionChooser& chooser,
                                   const gfx::Size& the_one_size) {}

}  // namespace

// While clients should always strive to set their own constraints before
// querying the CaptureResolutionChooser, do test that the reasonable "default"
// behavior is exhibited beforehand.
TEST(CaptureResolutionChooserTest, DefaultCaptureSizeIfNeverSetConstraints) {}

// While clients should always strive to set the source size before querying the
// CaptureResolutionChooser, do test that the reasonable "default" behavior is
// exhibited beforehand.
TEST(CaptureResolutionChooserTest, ReasonableCaptureSizeWhenMissingSourceSize) {}

TEST(CaptureResolutionChooserTest,
     FixedResolutionPolicy_CaptureSizeAlwaysFixed) {}

TEST(CaptureResolutionChooserTest,
     FixedAspectRatioPolicy_CaptureSizeHasSameAspectRatio) {}

TEST(CaptureResolutionChooserTest,
     AnyWithinLimitPolicy_CaptureSizeIsAnythingWithinLimits) {}

}  // namespace media