#include "chrome/browser/ui/webui/print_preview/print_preview_utils.h"
#include <memory>
#include <string_view>
#include "base/strings/string_number_conversions.h"
#include "base/test/values_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"
namespace printing {
namespace {
const char kCollate[] = …;
const char kDisplayName[] = …;
const char kDpi[] = …;
const char kHorizontalDpi[] = …;
const char kId[] = …;
const char kIsDefault[] = …;
const char kMediaHeight[] = …;
const char kMediaIsContinuousFeed[] = …;
const char kMediaSizeKey[] = …;
const char kMediaWidth[] = …;
const char kMediaSizes[] = …;
const char kPagesPerSheet[] = …;
const char kPaperType[] = …;
const char kPrinter[] = …;
const char kResetToDefault[] = …;
const char kValue[] = …;
const char kVendorCapability[] = …;
const char kVerticalDpi[] = …;
base::Value::Dict GetCapabilitiesFull() { … }
base::Value::Dict* GetVendorCapabilityAtIndex(base::Value::Dict& printer,
size_t index) { … }
base::Value::List ValidList(const base::Value::List* list) { … }
bool HasValidEntry(const base::Value::List* list) { … }
void CompareStringKeys(const base::Value::Dict& expected,
const base::Value::Dict& actual,
std::string_view key) { … }
void ValidateList(const base::Value::List* list_out,
const base::Value::List* input_list) { … }
void ValidateMedia(const base::Value::Dict* printer_out,
const base::Value::List* expected_list) { … }
void ValidateDpi(const base::Value::Dict* printer_out,
const base::Value::Dict* expected_dpi) { … }
void ValidateCollate(const base::Value::Dict* printer_out) { … }
void ValidateVendorCaps(const base::Value::Dict* printer_out,
const base::Value::List* input_vendor_caps) { … }
void ValidatePrinter(const base::Value::Dict& cdd_out,
const base::Value::Dict& printer) { … }
bool GetDpiResetToDefault(base::Value::Dict cdd) { … }
base::Value::Dict CreateCddWithMediaOptions(base::Value::List options) { … }
}
PrintPreviewUtilsTest;
TEST_F(PrintPreviewUtilsTest, FullCddPassthrough) { … }
TEST_F(PrintPreviewUtilsTest, FilterBadList) { … }
TEST_F(PrintPreviewUtilsTest, FilterBadOptionOneElement) { … }
TEST_F(PrintPreviewUtilsTest, FilterBadOptionAllElement) { … }
TEST_F(PrintPreviewUtilsTest, FilterBadVendorCapabilityAllElement) { … }
TEST_F(PrintPreviewUtilsTest, FilterBadVendorCapabilityOneElement) { … }
TEST_F(PrintPreviewUtilsTest, FilterBadDpis) { … }
TEST_F(PrintPreviewUtilsTest, CddResetToDefault) { … }
TEST_F(PrintPreviewUtilsTest, AddMissingDpi) { … }
TEST_F(PrintPreviewUtilsTest, ExistingValidDpiCapabilityDoesNotChange) { … }
TEST_F(PrintPreviewUtilsTest, FilterMediaSizesNoContinuousFeed) { … }
TEST_F(PrintPreviewUtilsTest, FilterMediaSizesWithContinuousFeed) { … }
TEST_F(PrintPreviewUtilsTest, FilterMediaSizesAllContinuousFeed) { … }
}