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

Side by Side Diff: extensions/common/api/printer_provider/usb_printer_manifest_unittest.cc

Issue 1123093003: Add a manifest property declaring USB printers supported by an app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix interfaceProtocol documentation. Created 5 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "device/usb/usb_device_filter.h"
6 #include "extensions/common/api/printer_provider/usb_printer_manifest_data.h"
7 #include "extensions/common/manifest_test.h"
8 #include "extensions/common/value_builder.h"
9
10 namespace extensions {
11
12 class UsbPrinterManifestTest : public ManifestTest {
13 public:
14 UsbPrinterManifestTest() {}
15 ~UsbPrinterManifestTest() override {}
16 };
17
18 TEST_F(UsbPrinterManifestTest, Filters) {
19 scoped_refptr<Extension> extension =
20 LoadAndExpectSuccess("usb_printers_filters.json");
21 const UsbPrinterManifestData* manifest_data =
22 UsbPrinterManifestData::Get(extension.get());
23 ASSERT_TRUE(manifest_data);
24 EXPECT_EQ(2u, manifest_data->filters().size());
25 EXPECT_TRUE(DictionaryBuilder()
26 .Set("vendorId", 1)
27 .Set("productId", 2)
28 .Build()
29 ->Equals(manifest_data->filters()[0].ToValue().get()));
30 EXPECT_TRUE(DictionaryBuilder()
31 .Set("vendorId", 1)
32 .Set("interfaceClass", 2)
33 .Set("interfaceSubclass", 3)
34 .Set("interfaceProtocol", 4)
35 .Build()
36 ->Equals(manifest_data->filters()[1].ToValue().get()));
37 }
38
39 TEST_F(UsbPrinterManifestTest, InvalidFilter) {
40 LoadAndExpectError(
41 "usb_printers_invalid_filter.json",
42 "Only one of productId or interfaceClass may be specified.");
43 }
44
45 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/api/printer_provider/usb_printer_manifest_handler.cc ('k') | extensions/common/common_manifest_handlers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698