Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(944)

Unified Diff: chromeos/printing/printer_translator_unittest.cc

Issue 2956173002: Introduce the field make_and_model for synced printers. (Closed)
Patch Set: done Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/printing/printer_translator.cc ('k') | components/sync/protocol/printer_specifics.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/printing/printer_translator_unittest.cc
diff --git a/chromeos/printing/printer_translator_unittest.cc b/chromeos/printing/printer_translator_unittest.cc
index 16995ef65f40c82f9cfc617ce8acf424ed3b803b..0723be1e3398841ac8611de838786ba20885de05 100644
--- a/chromeos/printing/printer_translator_unittest.cc
+++ b/chromeos/printing/printer_translator_unittest.cc
@@ -19,11 +19,13 @@ namespace printing {
const char kHash[] = "ABCDEF123456";
const char kName[] = "Chrome Super Printer";
const char kDescription[] = "first star on the left";
-const char kMake[] = "Chrome";
-const char kModel[] = "Inktastic Laser Magic";
const char kUri[] = "ipp://printy.domain.co:555/ipp/print";
const char kUUID[] = "UUID-UUID-UUID";
+const char kMake[] = "Chrome";
+const char kModel[] = "Inktastic Laser Magic";
+const char kMakeAndModel[] = "Chrome Inktastic Laser Magic";
+
const base::Time kTimestamp = base::Time::FromInternalValue(445566);
// PpdReference test data
@@ -118,6 +120,7 @@ TEST(PrinterTranslatorTest, RecommendedPrinterToPrinter) {
EXPECT_EQ(kDescription, printer->description());
EXPECT_EQ(kMake, printer->manufacturer());
EXPECT_EQ(kModel, printer->model());
+ EXPECT_EQ(kMakeAndModel, printer->make_and_model());
EXPECT_EQ(kUri, printer->uri());
EXPECT_EQ(kUUID, printer->uuid());
EXPECT_EQ(kTimestamp, printer->last_updated());
@@ -126,5 +129,37 @@ TEST(PrinterTranslatorTest, RecommendedPrinterToPrinter) {
printer->ppd_reference().effective_make_and_model);
}
+TEST(PrinterTranslatorTest, RecommendedPrinterToPrinterBlankManufacturer) {
+ base::DictionaryValue preference;
+ preference.SetString("id", kHash);
+ preference.SetString("display_name", kName);
+ preference.SetString("model", kModel);
+ preference.SetString("uri", kUri);
+ preference.SetString("ppd_resource.effective_model", kEffectiveMakeAndModel);
+
+ std::unique_ptr<Printer> printer =
+ RecommendedPrinterToPrinter(preference, kTimestamp);
+ EXPECT_TRUE(printer);
+
+ EXPECT_EQ(kModel, printer->model());
+ EXPECT_EQ(kModel, printer->make_and_model());
+}
+
+TEST(PrinterTranslatorTest, RecommendedPrinterToPrinterBlankModel) {
+ base::DictionaryValue preference;
+ preference.SetString("id", kHash);
+ preference.SetString("display_name", kName);
+ preference.SetString("manufacturer", kMake);
+ preference.SetString("uri", kUri);
+ preference.SetString("ppd_resource.effective_model", kEffectiveMakeAndModel);
+
+ std::unique_ptr<Printer> printer =
+ RecommendedPrinterToPrinter(preference, kTimestamp);
+ EXPECT_TRUE(printer);
+
+ EXPECT_EQ(kMake, printer->manufacturer());
+ EXPECT_EQ(kMake, printer->make_and_model());
+}
+
} // namespace printing
} // namespace chromeos
« no previous file with comments | « chromeos/printing/printer_translator.cc ('k') | components/sync/protocol/printer_specifics.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698