Commit 9c725992 authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Commit Bot

Rename cups_ipp_util* files to cups_ipp_helper*

Currently, cups_ipp_util.h is used by files outside of the "printing"
target, and contains exported methods. However, we might want to add
utility functions that we don't want to expose to other targets, and we
might want to place these in a header that is named similarly to
cups_ipp_util.h.

The name cups_ipp_helper.h was chosen because it contains methods
for parsing IPP printer attributes, and cups_helper.h, which contains
methods for parsing PPD printer attributes, already exists. The new
name is consistent with the existing one.

Bug: 226176
Change-Id: I333d4380e6e333c319989879d41d93404a38de4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2062579Reviewed-by: default avatarSean Kau <skau@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Auto-Submit: Daniel Hosseinian <dhoss@chromium.org>
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743330}
parent a9e92e5c
......@@ -21,7 +21,7 @@
#include "chrome/services/cups_proxy/ipp_attribute_validator.h"
#include "chrome/services/cups_proxy/public/cpp/cups_util.h"
#include "net/http/http_util.h"
#include "printing/backend/cups_ipp_util.h"
#include "printing/backend/cups_ipp_helper.h"
namespace cups_proxy {
namespace {
......
......@@ -13,7 +13,7 @@
#include "chrome/services/cups_proxy/fake_cups_proxy_service_delegate.h"
#include "chrome/services/cups_proxy/public/cpp/cups_util.h"
#include "chrome/services/cups_proxy/public/cpp/ipp_messages.h"
#include "printing/backend/cups_ipp_util.h"
#include "printing/backend/cups_ipp_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cups_proxy {
......
......@@ -14,7 +14,7 @@
#include "base/test/task_environment.h"
#include "chrome/services/cups_proxy/fake_cups_proxy_service_delegate.h"
#include "chrome/services/cups_proxy/printer_installer.h"
#include "printing/backend/cups_ipp_util.h"
#include "printing/backend/cups_ipp_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cups_proxy {
......
......@@ -30,7 +30,7 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
#include "printing/backend/cups_ipp_util.h"
#include "printing/backend/cups_ipp_helper.h"
#include "services/service_manager/public/cpp/connector.h"
namespace cups_proxy {
......
......@@ -13,7 +13,7 @@
#include "base/optional.h"
#include "chrome/services/ipp_parser/public/cpp/ipp_converter.h"
#include "printing/backend/cups_ipp_util.h"
#include "printing/backend/cups_ipp_helper.h"
// POD representations of HTTP/IPP objects.
namespace cups_proxy {
......
......@@ -12,7 +12,7 @@
#include "base/containers/span.h"
#include "base/strings/string_piece.h"
#include "chrome/services/ipp_parser/public/mojom/ipp_parser.mojom.h"
#include "printing/backend/cups_ipp_util.h"
#include "printing/backend/cups_ipp_helper.h"
// This namespace is filled with helpful (conversion) functions for working with
// arbitrary byte buffers representing IPP requests.
......
......@@ -191,8 +191,8 @@ component("printing") {
"backend/cups_deleters.h",
"backend/cups_ipp_constants.cc",
"backend/cups_ipp_constants.h",
"backend/cups_ipp_util.cc",
"backend/cups_ipp_util.h",
"backend/cups_ipp_helper.cc",
"backend/cups_ipp_helper.h",
"backend/cups_jobs.cc",
"backend/cups_jobs.h",
"backend/cups_printer.cc",
......@@ -219,8 +219,8 @@ component("printing") {
sources += [
"backend/cups_ipp_constants.cc",
"backend/cups_ipp_constants.h",
"backend/cups_ipp_util.cc",
"backend/cups_ipp_util.h",
"backend/cups_ipp_helper.cc",
"backend/cups_ipp_helper.h",
]
}
}
......@@ -325,7 +325,7 @@ test("printing_unittests") {
configs += [ ":cups" ]
if (is_chromeos) {
sources += [ "backend/cups_ipp_util_unittest.cc" ]
sources += [ "backend/cups_ipp_helper_unittest.cc" ]
} else {
sources += [ "backend/cups_helper_unittest.cc" ]
if (is_linux) {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "printing/backend/cups_ipp_util.h"
#include "printing/backend/cups_ipp_helper.h"
#include <cups/cups.h>
......@@ -17,6 +17,7 @@
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "printing/backend/cups_connection.h"
#include "printing/backend/cups_ipp_constants.h"
#include "printing/backend/cups_printer.h"
#include "printing/backend/print_backend_consts.h"
......
......@@ -4,8 +4,8 @@
// Methods for parsing IPP Printer attributes.
#ifndef PRINTING_BACKEND_CUPS_IPP_UTIL_H_
#define PRINTING_BACKEND_CUPS_IPP_UTIL_H_
#ifndef PRINTING_BACKEND_CUPS_IPP_HELPER_H_
#define PRINTING_BACKEND_CUPS_IPP_HELPER_H_
#include <memory>
......@@ -33,4 +33,4 @@ PRINTING_EXPORT ScopedIppPtr WrapIpp(ipp_t* ipp);
} // namespace printing
#endif // PRINTING_BACKEND_CUPS_IPP_UTIL_H_
#endif // PRINTING_BACKEND_CUPS_IPP_HELPER_H_
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "printing/backend/cups_ipp_helper.h"
#include <cups/cups.h>
#include <map>
......@@ -10,7 +12,6 @@
#include "base/logging.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "printing/backend/cups_ipp_util.h"
#include "printing/backend/cups_printer.h"
#include "printing/printing_features.h"
#include "testing/gmock/include/gmock/gmock.h"
......@@ -68,7 +69,7 @@ class MockCupsOptionProvider : public CupsOptionProvider {
std::map<base::StringPiece, ipp_attribute_t*> default_attributes_;
};
class PrintBackendCupsIppUtilTest : public ::testing::Test {
class PrintBackendCupsIppHelperTest : public ::testing::Test {
protected:
void SetUp() override {
ipp_ = ippNew();
......@@ -110,7 +111,7 @@ ipp_attribute_t* MakeStringCollection(ipp_t* ipp,
strings.size(), nullptr, strings.data());
}
TEST_F(PrintBackendCupsIppUtilTest, CopiesCapable) {
TEST_F(PrintBackendCupsIppHelperTest, CopiesCapable) {
printer_->SetSupportedOptions("copies", MakeRange(ipp_, 1, 2));
PrinterSemanticCapsAndDefaults caps;
......@@ -119,7 +120,7 @@ TEST_F(PrintBackendCupsIppUtilTest, CopiesCapable) {
EXPECT_TRUE(caps.copies_capable);
}
TEST_F(PrintBackendCupsIppUtilTest, CopiesNotCapable) {
TEST_F(PrintBackendCupsIppHelperTest, CopiesNotCapable) {
// copies missing, no setup
PrinterSemanticCapsAndDefaults caps;
CapsAndDefaultsFromPrinter(*printer_, &caps);
......@@ -127,7 +128,7 @@ TEST_F(PrintBackendCupsIppUtilTest, CopiesNotCapable) {
EXPECT_FALSE(caps.copies_capable);
}
TEST_F(PrintBackendCupsIppUtilTest, ColorPrinter) {
TEST_F(PrintBackendCupsIppHelperTest, ColorPrinter) {
printer_->SetSupportedOptions(
"print-color-mode", MakeStringCollection(ipp_, {"color", "monochrome"}));
printer_->SetOptionDefault("print-color-mode", MakeString(ipp_, "color"));
......@@ -139,7 +140,7 @@ TEST_F(PrintBackendCupsIppUtilTest, ColorPrinter) {
EXPECT_TRUE(caps.color_default);
}
TEST_F(PrintBackendCupsIppUtilTest, BWPrinter) {
TEST_F(PrintBackendCupsIppHelperTest, BWPrinter) {
printer_->SetSupportedOptions("print-color-mode",
MakeStringCollection(ipp_, {"monochrome"}));
printer_->SetOptionDefault("print-color-mode",
......@@ -152,7 +153,7 @@ TEST_F(PrintBackendCupsIppUtilTest, BWPrinter) {
EXPECT_FALSE(caps.color_default);
}
TEST_F(PrintBackendCupsIppUtilTest, DuplexSupported) {
TEST_F(PrintBackendCupsIppHelperTest, DuplexSupported) {
printer_->SetSupportedOptions(
"sides",
MakeStringCollection(ipp_, {"two-sided-long-edge", "one-sided"}));
......@@ -166,7 +167,7 @@ TEST_F(PrintBackendCupsIppUtilTest, DuplexSupported) {
EXPECT_EQ(SIMPLEX, caps.duplex_default);
}
TEST_F(PrintBackendCupsIppUtilTest, DuplexNotSupported) {
TEST_F(PrintBackendCupsIppHelperTest, DuplexNotSupported) {
printer_->SetSupportedOptions("sides",
MakeStringCollection(ipp_, {"one-sided"}));
printer_->SetOptionDefault("sides", MakeString(ipp_, "one-sided"));
......@@ -178,7 +179,7 @@ TEST_F(PrintBackendCupsIppUtilTest, DuplexNotSupported) {
EXPECT_EQ(SIMPLEX, caps.duplex_default);
}
TEST_F(PrintBackendCupsIppUtilTest, A4PaperSupported) {
TEST_F(PrintBackendCupsIppHelperTest, A4PaperSupported) {
printer_->SetSupportedOptions(
"media", MakeStringCollection(ipp_, {"iso_a4_210x297mm"}));
......@@ -194,7 +195,7 @@ TEST_F(PrintBackendCupsIppUtilTest, A4PaperSupported) {
EXPECT_EQ(297000, paper.size_um.height());
}
TEST_F(PrintBackendCupsIppUtilTest, LegalPaperDefault) {
TEST_F(PrintBackendCupsIppHelperTest, LegalPaperDefault) {
printer_->SetOptionDefault("media", MakeString(ipp_, "na_legal_8.5x14in"));
PrinterSemanticCapsAndDefaults caps;
......@@ -211,7 +212,7 @@ TEST_F(PrintBackendCupsIppUtilTest, LegalPaperDefault) {
// with badly formatted vendor IDs - such papers will not transform into
// meaningful ParsedPaper instances and are sometimes inimical to
// ARC++.
TEST_F(PrintBackendCupsIppUtilTest, OmitPapersWithoutVendorIds) {
TEST_F(PrintBackendCupsIppHelperTest, OmitPapersWithoutVendorIds) {
printer_->SetSupportedOptions(
"media", MakeStringCollection(ipp_, {"jis_b5_182x257mm", "invalidsize",
"", "iso_b5_176x250mm"}));
......@@ -239,7 +240,7 @@ TEST_F(PrintBackendCupsIppUtilTest, OmitPapersWithoutVendorIds) {
// Tests that CapsAndDefaultsFromPrinter() does not propagate the
// special IPP values that CUPS happens to expose to the Chromium print
// backend.
TEST_F(PrintBackendCupsIppUtilTest, OmitPapersWithSpecialVendorIds) {
TEST_F(PrintBackendCupsIppHelperTest, OmitPapersWithSpecialVendorIds) {
// Maintainer's note: there's no reason why a printer would deliver
// two discrete sizes for custom_min* and custom_max*; in practice,
// we always see the fully qualified custom_m(in|ax)_<DIMENSIONS>
......@@ -274,7 +275,7 @@ TEST_F(PrintBackendCupsIppUtilTest, OmitPapersWithSpecialVendorIds) {
"iso b0")));
}
TEST_F(PrintBackendCupsIppUtilTest, PinSupported) {
TEST_F(PrintBackendCupsIppHelperTest, PinSupported) {
printer_->SetSupportedOptions("job-password", MakeInteger(ipp_, 4));
printer_->SetSupportedOptions("job-password-encryption",
MakeStringCollection(ipp_, {"none"}));
......@@ -285,7 +286,7 @@ TEST_F(PrintBackendCupsIppUtilTest, PinSupported) {
EXPECT_TRUE(caps.pin_supported);
}
TEST_F(PrintBackendCupsIppUtilTest, PinNotSupported) {
TEST_F(PrintBackendCupsIppHelperTest, PinNotSupported) {
// Pin support missing, no setup.
PrinterSemanticCapsAndDefaults caps;
CapsAndDefaultsFromPrinter(*printer_, &caps);
......@@ -293,7 +294,7 @@ TEST_F(PrintBackendCupsIppUtilTest, PinNotSupported) {
EXPECT_FALSE(caps.pin_supported);
}
TEST_F(PrintBackendCupsIppUtilTest, PinEncryptionNotSupported) {
TEST_F(PrintBackendCupsIppHelperTest, PinEncryptionNotSupported) {
printer_->SetSupportedOptions("job-password", MakeInteger(ipp_, 4));
PrinterSemanticCapsAndDefaults caps;
......@@ -302,7 +303,7 @@ TEST_F(PrintBackendCupsIppUtilTest, PinEncryptionNotSupported) {
EXPECT_FALSE(caps.pin_supported);
}
TEST_F(PrintBackendCupsIppUtilTest, PinTooShort) {
TEST_F(PrintBackendCupsIppHelperTest, PinTooShort) {
printer_->SetSupportedOptions("job-password", MakeInteger(ipp_, 3));
printer_->SetSupportedOptions("job-password-encryption",
MakeStringCollection(ipp_, {"none"}));
......@@ -313,7 +314,7 @@ TEST_F(PrintBackendCupsIppUtilTest, PinTooShort) {
EXPECT_FALSE(caps.pin_supported);
}
TEST_F(PrintBackendCupsIppUtilTest, AdvancedCaps) {
TEST_F(PrintBackendCupsIppHelperTest, AdvancedCaps) {
base::HistogramTester histograms;
base::test::ScopedFeatureList features;
features.InitAndEnableFeature(printing::features::kAdvancedPpdAttributes);
......
......@@ -17,7 +17,7 @@
#include "base/threading/scoped_blocking_call.h"
#include "base/version.h"
#include "printing/backend/cups_deleters.h"
#include "printing/backend/cups_ipp_util.h"
#include "printing/backend/cups_ipp_helper.h"
namespace printing {
namespace {
......
......@@ -15,7 +15,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "printing/backend/cups_connection.h"
#include "printing/backend/cups_ipp_util.h"
#include "printing/backend/cups_ipp_helper.h"
#include "printing/backend/print_backend_consts.h"
#include "printing/units.h"
......
......@@ -23,7 +23,7 @@
#include "base/strings/utf_string_conversions.h"
#include "printing/backend/cups_connection.h"
#include "printing/backend/cups_ipp_constants.h"
#include "printing/backend/cups_ipp_util.h"
#include "printing/backend/cups_ipp_helper.h"
#include "printing/backend/cups_printer.h"
#include "printing/metafile.h"
#include "printing/print_job_constants.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment