chromium/printing/print_settings_conversion_unittest.cc

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

#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  // !BUILDFLAG(IS_MAC)

const char kCustomMargins[] =;

}  // namespace

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  // !BUILDFLAG(IS_MAC)

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  // BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) &&
        // BUILDFLAG(USE_CUPS))

}  // namespace printing