#include "printing/print_settings_conversion.h"
#include "base/containers/contains.h"
#include "base/test/values_test_util.h"
#include "base/values.h"
#include "build/build_config.h"
#include "printing/buildflags/buildflags.h"
#include "printing/mojom/print.mojom.h"
#include "printing/print_settings.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace printing {
namespace {
const char kPrinterSettings[] = …;
const char kPrinterSettingsWithImageableArea[] = …;
#if !BUILDFLAG(IS_MAC)
const char kPrinterSettingsWithNonSquarePixels[] = …;
#endif
const char kCustomMargins[] = …;
}
TEST(PrintSettingsConversionTest, InvalidSettings) { … }
TEST(PrintSettingsConversionTest, Conversion) { … }
TEST(PrintSettingsConversionTest, WithValidImageableArea) { … }
TEST(PrintSettingsConversionTest, WithValidFlippedImageableArea) { … }
TEST(PrintSettingsConversionTest, WithOutOfBoundsImageableArea) { … }
TEST(PrintSettingsConversionTest, WithMissingImageableAreaValue) { … }
TEST(PrintSettingsConversionTest, WithCustomMarginsAndImageableArea) { … }
#if !BUILDFLAG(IS_MAC)
TEST(PrintSettingsConversionTest, WithNonSquarePixels) { … }
#endif
TEST(PrintSettingsConversionTest, MissingDeviceName) { … }
#if BUILDFLAG(IS_CHROMEOS)
TEST(PrintSettingsConversionTest, DontSendUsername) {
base::Value::Dict dict = base::test::ParseJsonDict(kPrinterSettings);
dict.Set(kSettingSendUserInfo, false);
std::unique_ptr<PrintSettings> settings = PrintSettingsFromJobSettings(dict);
ASSERT_TRUE(settings);
EXPECT_FALSE(settings->send_user_info());
EXPECT_EQ("", settings->username());
}
#endif
#if BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_CUPS))
TEST(PrintSettingsConversionTest, FilterNonJobSettings) { … }
#endif
}