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

Side by Side Diff: chrome/browser/chromeos/printing/specifics_translation_unittest.cc

Issue 2858353004: Track printer installations for each configuration. (Closed)
Patch Set: default argument Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <utility> 5 #include <utility>
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/chromeos/printing/specifics_translation.h" 8 #include "chrome/browser/chromeos/printing/specifics_translation.h"
9 #include "chromeos/printing/printer_configuration.h" 9 #include "chromeos/printing/printer_configuration.h"
10 #include "components/sync/protocol/printer_specifics.pb.h" 10 #include "components/sync/protocol/printer_specifics.pb.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace { 13 namespace {
14 14
15 const char id[] = "UNIQUE_ID"; 15 const char id[] = "UNIQUE_ID";
16 const char display_name[] = "Best Printer Ever"; 16 const char display_name[] = "Best Printer Ever";
17 const char description[] = "The green one"; 17 const char description[] = "The green one";
18 const char manufacturer[] = "Manufacturer"; 18 const char manufacturer[] = "Manufacturer";
19 const char model[] = "MODEL"; 19 const char model[] = "MODEL";
20 const char uri[] = "ipps://notaprinter.chromium.org/ipp/print"; 20 const char uri[] = "ipps://notaprinter.chromium.org/ipp/print";
21 const char uuid[] = "UUIDUUIDUUID"; 21 const char uuid[] = "UUIDUUIDUUID";
22 const int64_t kUpdateTime = 445566;
22 23
23 const char effective_make_and_model[] = "Manufacturer Model T1000"; 24 const char effective_make_and_model[] = "Manufacturer Model T1000";
24 25
25 } // namespace 26 } // namespace
26 27
27 namespace chromeos { 28 namespace chromeos {
28 namespace printing { 29 namespace printing {
29 30
30 TEST(SpecificsTranslationTest, SpecificsToPrinter) { 31 TEST(SpecificsTranslationTest, SpecificsToPrinter) {
31 sync_pb::PrinterSpecifics specifics; 32 sync_pb::PrinterSpecifics specifics;
32 specifics.set_id(id); 33 specifics.set_id(id);
33 specifics.set_display_name(display_name); 34 specifics.set_display_name(display_name);
34 specifics.set_description(description); 35 specifics.set_description(description);
35 specifics.set_manufacturer(manufacturer); 36 specifics.set_manufacturer(manufacturer);
36 specifics.set_model(model); 37 specifics.set_model(model);
37 specifics.set_uri(uri); 38 specifics.set_uri(uri);
38 specifics.set_uuid(uuid); 39 specifics.set_uuid(uuid);
40 specifics.set_updated_timestamp(kUpdateTime);
39 41
40 sync_pb::PrinterPPDReference ppd; 42 sync_pb::PrinterPPDReference ppd;
41 ppd.set_effective_make_and_model(effective_make_and_model); 43 ppd.set_effective_make_and_model(effective_make_and_model);
42 *specifics.mutable_ppd_reference() = ppd; 44 *specifics.mutable_ppd_reference() = ppd;
43 45
44 std::unique_ptr<Printer> result = SpecificsToPrinter(specifics); 46 std::unique_ptr<Printer> result = SpecificsToPrinter(specifics);
45 EXPECT_EQ(id, result->id()); 47 EXPECT_EQ(id, result->id());
46 EXPECT_EQ(display_name, result->display_name()); 48 EXPECT_EQ(display_name, result->display_name());
47 EXPECT_EQ(description, result->description()); 49 EXPECT_EQ(description, result->description());
48 EXPECT_EQ(manufacturer, result->manufacturer()); 50 EXPECT_EQ(manufacturer, result->manufacturer());
49 EXPECT_EQ(model, result->model()); 51 EXPECT_EQ(model, result->model());
50 EXPECT_EQ(uri, result->uri()); 52 EXPECT_EQ(uri, result->uri());
51 EXPECT_EQ(uuid, result->uuid()); 53 EXPECT_EQ(uuid, result->uuid());
54 EXPECT_EQ(kUpdateTime, result->last_updated());
52 55
53 EXPECT_EQ(effective_make_and_model, 56 EXPECT_EQ(effective_make_and_model,
54 result->ppd_reference().effective_make_and_model); 57 result->ppd_reference().effective_make_and_model);
55 } 58 }
56 59
57 TEST(SpecificsTranslationTest, PrinterToSpecifics) { 60 TEST(SpecificsTranslationTest, PrinterToSpecifics) {
58 Printer printer; 61 Printer printer;
59 printer.set_id(id); 62 printer.set_id(id);
60 printer.set_display_name(display_name); 63 printer.set_display_name(display_name);
61 printer.set_description(description); 64 printer.set_description(description);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 EXPECT_EQ(model, result->model()); 109 EXPECT_EQ(model, result->model());
107 EXPECT_EQ(uri, result->uri()); 110 EXPECT_EQ(uri, result->uri());
108 EXPECT_EQ(uuid, result->uuid()); 111 EXPECT_EQ(uuid, result->uuid());
109 112
110 EXPECT_EQ(effective_make_and_model, 113 EXPECT_EQ(effective_make_and_model,
111 result->ppd_reference().effective_make_and_model); 114 result->ppd_reference().effective_make_and_model);
112 } 115 }
113 116
114 } // namespace printing 117 } // namespace printing
115 } // namespace chromeos 118 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698